Implement most new Quiz modes (see #3) except proper overtime for FSA.
Probably quite buggy
This commit is contained in:
parent
57a52478cc
commit
57846a83c9
|
@ -3,9 +3,9 @@ Aluminium
|
||||||
Titanum
|
Titanum
|
||||||
All the above" "1
|
All the above" "1
|
||||||
2"
|
2"
|
||||||
ChooseOne What is depicted on the picture "7 speed double cluth transmission for AWD
|
ChooseOne What is depicted on the picture "7 speed double clutch transmission for AWD
|
||||||
8 speed double cluth transmission for AWD
|
8 speed double clutch transmission for AWD
|
||||||
7 speed double cluth transmission for 2WD
|
7 speed double clutch transmission for 2WD
|
||||||
Automatic transmission with torque conventer" 1 FSCzech https://i.ibb.co/56LM89v/chiron-transmission.jpg
|
Automatic transmission with torque conventer" 1 FSCzech https://i.ibb.co/56LM89v/chiron-transmission.jpg
|
||||||
Text Calculate the (1) torsional- and (2) bending-nominal stress at the critical cross section for the load case shown below. Answer in N / mm² and round to one decimal place. Given: P = 12kW; n = 980 1/min; F = 500 N; xkrit = 110 mm; 0 ≤ x0 ≤ 120mm "torsional-nominal stress
|
Text Calculate the (1) torsional- and (2) bending-nominal stress at the critical cross section for the load case shown below. Answer in N / mm² and round to one decimal place. Given: P = 12kW; n = 980 1/min; F = 500 N; xkrit = 110 mm; 0 ≤ x0 ≤ 120mm "torsional-nominal stress
|
||||||
bending-nominal stress" "17.1
|
bending-nominal stress" "17.1
|
||||||
|
|
Can't render this file because it has a wrong number of fields in line 6.
|
|
@ -11,6 +11,10 @@
|
||||||
|
|
||||||
<title>FS Quiz tool</title>
|
<title>FS Quiz tool</title>
|
||||||
|
|
||||||
|
<script src="util.js"></script>
|
||||||
|
<script src="ssparser.js"></script>
|
||||||
|
<script src="share.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -50,13 +54,13 @@
|
||||||
switch (drf_sf.value) {
|
switch (drf_sf.value) {
|
||||||
case 'FSG':
|
case 'FSG':
|
||||||
case 'FSA':
|
case 'FSA':
|
||||||
drf_ef.innerHTML = 'Minutes per question:<br><input type="number" id="qTimeField" value="5" min="1" max="30" required>'
|
drf_ef.innerHTML = 'Minutes per question:<br><input type="number" id="qTimeField" value="'+(rules[drf_sf.value].questionTimeout)+'" min="1" max="30" required>'
|
||||||
break
|
break
|
||||||
case 'FSCzech':
|
case 'FSCzech':
|
||||||
drf_ef.innerHTML = 'Seconds Timeout after handin:<br><input type="number" id="sTOutField" value="30" min="1" max="300" required>'
|
drf_ef.innerHTML = 'Seconds Timeout after handin:<br><input type="number" id="sTOutField" value="'+(rules['FSCzech'].submitTimeout)+'" min="1" max="300" required>'
|
||||||
break
|
break
|
||||||
case 'FSSpain':
|
case 'FSSpain':
|
||||||
drf_ef.innerHTML = 'Number of handin tries:<br><input type="number" id="sTriesField" value="3" min="1" max="10" required>'
|
drf_ef.innerHTML = 'Number of handin tries:<br><input type="number" id="sTriesField" value="'+(rules['FSSpain'].submitTries)+'" min="1" max="10" required>'
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
drf_ef.innerHTML = ''
|
drf_ef.innerHTML = ''
|
||||||
|
@ -87,7 +91,7 @@
|
||||||
</div>
|
</div>
|
||||||
<form>
|
<form>
|
||||||
</form>
|
</form>
|
||||||
<input type="button" value="Submit" onclick="submitQuiz()" style="background: #008029" id="quizSubmitButton" disabled>
|
<input type="button" value="Submit" onclick="submitQuiz()" style="background: #008029" id="quizSubmitButton">
|
||||||
<input type="button" value="Abort" onclick="abortQuiz()">
|
<input type="button" value="Abort" onclick="abortQuiz()">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -107,9 +111,6 @@
|
||||||
· <span id="meme"></span>
|
· <span id="meme"></span>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="util.js"></script>
|
|
||||||
<script src="ssparser.js"></script>
|
|
||||||
<script src="share.js"></script>
|
|
||||||
<script src="quiz.js"></script>
|
<script src="quiz.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
78
web/quiz.js
78
web/quiz.js
|
@ -33,7 +33,14 @@ function updateSubmitButton() {
|
||||||
|
|
||||||
var lastQuestion = (state.currentQuestion == (state.questions.length - 1))
|
var lastQuestion = (state.currentQuestion == (state.questions.length - 1))
|
||||||
|
|
||||||
button.value = lastQuestion ? 'Submit Answers' : 'Next Question'
|
button.value = lastQuestion || !getRule('sequential') ? 'Submit Answers' : 'Next Question'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetSubmitButton() {
|
||||||
|
|
||||||
|
updateSubmitButton()
|
||||||
|
document.getElementById('quizSubmitButton').disabled = false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,16 +50,22 @@ function updateSubmitTimer() {
|
||||||
|
|
||||||
if (state.submitTimer > 0) {
|
if (state.submitTimer > 0) {
|
||||||
|
|
||||||
button.value = 'Wait ' + state.submitTimer + 's'
|
timetext = state.submitTimer > 60 ?
|
||||||
|
Math.floor(state.submitTimer/60)+':'+(('0' + (state.submitTimer%60)).slice(-2)) :
|
||||||
|
state.submitTimer + 's'
|
||||||
|
|
||||||
|
button.value = 'Wait ' + timetext
|
||||||
button.disabled = true
|
button.disabled = true
|
||||||
state.submitTimer -= 1
|
state.submitTimer -= 1
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
updateSubmitButton()
|
resetSubmitButton()
|
||||||
button.disabled = false
|
|
||||||
clearInterval(state.submitInterval)
|
clearInterval(state.submitInterval)
|
||||||
|
|
||||||
|
if (getRule('sequential') && !getRule('allowQOvertime'))
|
||||||
|
submitQuiz()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -97,6 +110,9 @@ function nextQuestion() {
|
||||||
|
|
||||||
showSequentialQuestion()
|
showSequentialQuestion()
|
||||||
|
|
||||||
|
if (state.currentQuestion !== null && getRule('questionTimeout'))
|
||||||
|
startSubmitTimer()
|
||||||
|
|
||||||
return state.currentQuestion
|
return state.currentQuestion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -165,10 +181,13 @@ function startQuiz() {
|
||||||
|
|
||||||
if (state.submitTimer > 0)
|
if (state.submitTimer > 0)
|
||||||
startSubmitTimer(state.submitTimer)
|
startSubmitTimer(state.submitTimer)
|
||||||
|
else if (getRule('questionTimeout'))
|
||||||
|
startSubmitTimer()
|
||||||
else
|
else
|
||||||
updateSubmitTimer()
|
resetSubmitButton()
|
||||||
|
|
||||||
startTotalTimer()
|
startTotalTimer()
|
||||||
|
state.running = true
|
||||||
|
|
||||||
console.log('Quiz started/resumed')
|
console.log('Quiz started/resumed')
|
||||||
|
|
||||||
|
@ -178,12 +197,15 @@ function reStartQuiz() {
|
||||||
|
|
||||||
console.log('Restarting quiz');
|
console.log('Restarting quiz');
|
||||||
|
|
||||||
state.currentQuestion = 0
|
state.currentQuestion = defaultState.currentQuestion
|
||||||
state.totalTimer = 0
|
state.success = defaultState.success
|
||||||
state.submitTimer = 0
|
state.submitTry = defaultState.submitTry
|
||||||
state.success = false
|
state.submitTimer = defaultState.submitTimer
|
||||||
|
state.submitInterval = defaultState.submitInterval
|
||||||
|
state.totalTimer = defaultState.totalTimer
|
||||||
|
state.totalInterval = defaultState.totalInterval
|
||||||
|
|
||||||
startQuiz()
|
changeView('prescreen')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,6 +248,8 @@ function endQuiz() {
|
||||||
|
|
||||||
console.log('Ending quiz')
|
console.log('Ending quiz')
|
||||||
|
|
||||||
|
state.running = false
|
||||||
|
|
||||||
localStorage.removeItem('state')
|
localStorage.removeItem('state')
|
||||||
|
|
||||||
document.querySelector('#quiz form').innerHTML = ''
|
document.querySelector('#quiz form').innerHTML = ''
|
||||||
|
@ -299,20 +323,31 @@ function submitQuiz() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = '' + correct + '/' + state.questions.length + ' questions answered correctly.\n'
|
var text = '' + correct + '/' + state.questions.length + ' questions answered correctly.'
|
||||||
|
|
||||||
state.success = (correct == state.questions.length)
|
state.success = (correct == state.questions.length)
|
||||||
|
|
||||||
text += state.success ? 'Yay you did it!' : 'Try again!'
|
|
||||||
|
|
||||||
if (!state.success) {
|
if (!state.success) {
|
||||||
renderQuiz()
|
state.submitTry++
|
||||||
startSubmitTimer()
|
|
||||||
alert(text)
|
if (getRule('submitTries') && state.submitTry < state.submitTries) {
|
||||||
|
alert(text + `\nThis was try ${state.submitTry}/${state.submitTries}\nClick OK to Try Again`)
|
||||||
|
renderQuiz()
|
||||||
|
if (getRule('sequential')) {
|
||||||
|
state.currentQuestion = 0
|
||||||
|
showSequentialQuestion(state.currentQuestion)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getRule('submitTimeout'))
|
||||||
|
startSubmitTimer()
|
||||||
|
} else {
|
||||||
|
document.querySelector('#postscreen h1').innerHTML = (text + '<br>Maybe next time :)')
|
||||||
|
endQuiz()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.success) {
|
if (state.success) {
|
||||||
document.querySelector('#postscreen h1').innerHTML = `Yay, we're done!<br>Everything is correct :)`
|
document.querySelector('#postscreen h1').innerHTML = (text + '<br>Yay you did it!')
|
||||||
endQuiz()
|
endQuiz()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,8 +374,6 @@ function abortQuiz() {
|
||||||
|
|
||||||
window.onload = async function() {
|
window.onload = async function() {
|
||||||
|
|
||||||
console.log('onload')
|
|
||||||
|
|
||||||
var browserWarning = document.getElementById('browserwarning')
|
var browserWarning = document.getElementById('browserwarning')
|
||||||
|
|
||||||
// If arrow functions are supported, it's modern enough :P
|
// If arrow functions are supported, it's modern enough :P
|
||||||
|
@ -349,7 +382,7 @@ window.onload = async function() {
|
||||||
var stateString = localStorage.getItem('state')
|
var stateString = localStorage.getItem('state')
|
||||||
|
|
||||||
var urlId = idFromUrl()
|
var urlId = idFromUrl()
|
||||||
console.log('URL ID:' + urlId)
|
console.log('URL ID:', urlId)
|
||||||
|
|
||||||
if (stateString) {
|
if (stateString) {
|
||||||
|
|
||||||
|
@ -378,7 +411,10 @@ window.onload = async function() {
|
||||||
document.getElementById('meme').innerHTML = meme
|
document.getElementById('meme').innerHTML = meme
|
||||||
|
|
||||||
if (stateString && !useUrl)
|
if (stateString && !useUrl)
|
||||||
startQuiz()
|
if (state.running)
|
||||||
|
startQuiz()
|
||||||
|
else
|
||||||
|
changeView('prescreen')
|
||||||
|
|
||||||
if (!stateString && !useUrl)
|
if (!stateString && !useUrl)
|
||||||
changeView('spreadsheet')
|
changeView('spreadsheet')
|
||||||
|
|
25
web/util.js
25
web/util.js
|
@ -2,19 +2,17 @@ const defaultState = {
|
||||||
style: 'FSCzech', // enum of { FSG, FSA, FSN, FSEast, FSCzech, FSSpain, FSSwitzerland }
|
style: 'FSCzech', // enum of { FSG, FSA, FSN, FSEast, FSCzech, FSSpain, FSSwitzerland }
|
||||||
id: null,
|
id: null,
|
||||||
title: null,
|
title: null,
|
||||||
|
running: false,
|
||||||
questions: [],
|
questions: [],
|
||||||
currentQuestion: 0,
|
currentQuestion: 0,
|
||||||
success: false,
|
success: false,
|
||||||
|
submitTry: 0,
|
||||||
submitTries: 1,
|
submitTries: 1,
|
||||||
submits: 0,
|
|
||||||
submitTime: null,
|
submitTime: null,
|
||||||
submitTimer: 0,
|
submitTimer: 0,
|
||||||
submitInterval: null,
|
submitInterval: null,
|
||||||
totalTimer: 0,
|
totalTimer: 0,
|
||||||
totalInterval: null,
|
totalInterval: null,
|
||||||
questionTime: null,
|
|
||||||
questionTimer: 0,
|
|
||||||
questionInterval: null,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var state
|
var state
|
||||||
|
@ -38,13 +36,13 @@ function updateTitles() {
|
||||||
var rules = {
|
var rules = {
|
||||||
__default__: {
|
__default__: {
|
||||||
sequential: false,
|
sequential: false,
|
||||||
submitTries: 1, // NYI
|
questionTimeout: null,
|
||||||
submitTimeout: null, // NYI
|
allowQOvertime: false, // Not implemented correctly
|
||||||
timedQs: false, // NYI
|
submitTries: 1,
|
||||||
allowQOvertime: false // NYI
|
submitTimeout: null
|
||||||
},
|
},
|
||||||
'FSG' : { sequential: true, timedQs: true },
|
'FSG' : { sequential: true, questionTimeout: 5 },
|
||||||
'FSA' : { sequential: true, timedQs: true, allowQOvertime: true },
|
'FSA' : { sequential: true, questionTimeout: 5, allowQOvertime: true },
|
||||||
'FSN' : { sequential: true },
|
'FSN' : { sequential: true },
|
||||||
'FSEast' : { sequential: false },
|
'FSEast' : { sequential: false },
|
||||||
'FSCzech' : { sequential: false, submitTries: Infinity, submitTimeout: 30 },
|
'FSCzech' : { sequential: false, submitTries: Infinity, submitTimeout: 30 },
|
||||||
|
@ -74,13 +72,14 @@ function applyRuleSettingsFromForm() {
|
||||||
switch (state.style) {
|
switch (state.style) {
|
||||||
case 'FSG':
|
case 'FSG':
|
||||||
case 'FSA':
|
case 'FSA':
|
||||||
state.questionTime = parseInt(document.getElementById('qTimeField').value)
|
state.submitTime = 60 * parseInt(document.getElementById('qTimeField').value)
|
||||||
break
|
break
|
||||||
case 'FSCzech':
|
case 'FSCzech':
|
||||||
state.submitTime = parseInt(document.getElementById('sTOutField').value)
|
state.submitTime = parseInt(document.getElementById('sTOutField').value)
|
||||||
|
state.submitTries = rules[state.style].submitTries
|
||||||
break
|
break
|
||||||
case 'FSSpain':
|
case 'FSSpain':
|
||||||
state.submitTries = parseInt(document.getElementById('sTriesField').value)
|
state.submitTries = parseInt(document.getElementById('sTriesField').value)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue