Allow setting time per question (resolves #7)

This commit is contained in:
Oskar Winkels 2021-01-22 19:12:06 +01:00
parent 7592752de0
commit b9a9ea8a1b
5 changed files with 25 additions and 7 deletions

View File

@ -39,6 +39,12 @@ D 1.1.1: "[...] a maximum of six drivers are allowed for each team"
John Doe
```
##### Time [minutes]
```text
3
```
## ChooseAny
##### Question Text
@ -81,6 +87,12 @@ Jane Doe
https://i.ibb.co/m8C9VZp/image.png
```
##### Time [minutes]
```text
3
```
## Text
##### Question Text
@ -120,3 +132,9 @@ Max Mustermann
```text
https://i.ibb.co/tYTdw86/2a.png
```
##### Time [minutes]
```text
7
```

View File

@ -2,11 +2,11 @@ ChooseAny Which Materials can be used to fabricate the brake pedal? "Steel
Aluminium
Titanum
All the above" "1
2"
2" 3
ChooseOne What is depicted on the picture "7 speed double clutch transmission for AWD
8 speed double clutch transmission for AWD
7 speed double clutch transmission for 2WD
Automatic transmission with torque conventer" 1 This gearbox is from the 2017 Bugatti Chiron FSCzech https://i.ibb.co/56LM89v/chiron-transmission.jpg
Automatic transmission with torque conventer" 1 This gearbox is from the 2017 Bugatti Chiron FSCzech https://i.ibb.co/56LM89v/chiron-transmission.jpg 5
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
18.2" https://i.ibb.co/1r3yqY7/2b.png https://i.ibb.co/tYTdw86/2a.png
18.2" https://i.ibb.co/1r3yqY7/2b.png https://i.ibb.co/tYTdw86/2a.png 7

Can't render this file because it has a wrong number of fields in line 6.

View File

@ -54,7 +54,7 @@
switch (drf_sf.value) {
case 'FSG':
case 'FSA':
drf_ef.innerHTML = 'Minutes per question:<br><input type="number" id="qTimeField" value="'+(rules[drf_sf.value].questionTimeout)+'" min="1" max="30" required>'
drf_ef.innerHTML = 'Default minutes per question:<br><input type="number" id="qTimeField" value="'+(rules[drf_sf.value].questionTimeout)+'" min="1" max="30" required>'
break
case 'FSCzech':
drf_ef.innerHTML = 'Seconds Timeout after handin:<br><input type="number" id="sTOutField" value="'+(rules['FSCzech'].submitTimeout)+'" min="1" max="300" required>'

View File

@ -73,7 +73,7 @@ function updateSubmitTimer() {
function startSubmitTimer(time) {
state.submitTimer = time || state.submitTime
state.submitTimer = time || state.questions[state.currentQuestion].time || state.submitTime
if (state.submitTimer == null)
return
@ -302,7 +302,6 @@ function showQuizResults() {
el.querySelector(`input[value="${ans}"]`).classList.add('trueans')
}
// TODO: Write out explanation, author
var meta = document.createElement('div')
meta.className = 'meta'
meta.innerHTML = `
@ -402,7 +401,7 @@ function submitQuiz() {
}
if (getRule('submitTimeout'))
startSubmitTimer()
startSubmitTimer(state.submitTime)
} else {
document.querySelector('#postscreen h1').innerHTML = (text + '<br>Maybe next time :)')
endQuiz()

View File

@ -52,6 +52,7 @@ function parseLine(line) {
q.explanation = els[4] || null
q.author = els[5] || null
q.picture = els[6] || null
q.time = Math.floor(60 * els[7]) || state.submitTime
return q