FSG: Not activey submitting will always be regarded as no answer (fail)
resolves #12
This commit is contained in:
		
							
								
								
									
										27
									
								
								web/quiz.js
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								web/quiz.js
									
									
									
									
									
								
							@ -90,7 +90,7 @@ function updateSubmitInfo() {
 | 
				
			|||||||
			if (getRule('allowQOvertime'))
 | 
								if (getRule('allowQOvertime'))
 | 
				
			||||||
				si.innerHTML = ('Losing bonus points in ' + formatTime(state.submitTimer))
 | 
									si.innerHTML = ('Losing bonus points in ' + formatTime(state.submitTimer))
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				si.innerHTML = ('Forced hand-in in ' + formatTime(state.submitTimer))
 | 
									si.innerHTML = ( 'Question failed in ' + formatTime(state.submitTimer))
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			if (getRule('allowQOvertime'))
 | 
								if (getRule('allowQOvertime'))
 | 
				
			||||||
				document.getElementById('submitinfo').innerHTML = 'Bonus points lost.'
 | 
									document.getElementById('submitinfo').innerHTML = 'Bonus points lost.'
 | 
				
			||||||
@ -103,6 +103,23 @@ function updateSubmitInfo() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function resetQuestionResponse(qn) {
 | 
				
			||||||
 | 
						var q = document.querySelector('#quiz form #question' + qn)
 | 
				
			||||||
 | 
						var inputs = q.querySelectorAll('input')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (input of inputs) {
 | 
				
			||||||
 | 
							switch (input.type) {
 | 
				
			||||||
 | 
								case 'radio':
 | 
				
			||||||
 | 
								case 'checkbox':
 | 
				
			||||||
 | 
									input.checked = false
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case 'text':
 | 
				
			||||||
 | 
									input.value = ""
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function updateSubmitTimer() {
 | 
					function updateSubmitTimer() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (state.submitTimer > 0)
 | 
						if (state.submitTimer > 0)
 | 
				
			||||||
@ -112,9 +129,11 @@ function updateSubmitTimer() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		clearInterval(state.submitInterval)
 | 
							clearInterval(state.submitInterval)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (getRule('questionTimeout'))
 | 
							if (getRule('questionTimeout') && !getRule('allowQOvertime')) {
 | 
				
			||||||
			if (state.waitNextQuestion || !getRule('allowQOvertime'))
 | 
								console.log("Question not submitted, clearing input");
 | 
				
			||||||
				submitQuiz() // Force next question
 | 
								resetQuestionResponse(state.currentQuestion);
 | 
				
			||||||
 | 
								submitQuiz() // Force next question
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user