Add grade calculation algorithm
This commit is contained in:
parent
bb9ec41cbd
commit
8bd6b16f71
|
@ -18,6 +18,15 @@
|
|||
"section.multiple.points.max": 10,
|
||||
"section.multiple.points.min": -10
|
||||
},
|
||||
"threshold":{
|
||||
"s.min": 10,
|
||||
"a.min": 8,
|
||||
"b.min": 4,
|
||||
"c.min": 0,
|
||||
"d.min": -3,
|
||||
"e.min": -5,
|
||||
"f.min": -8
|
||||
},
|
||||
|
||||
"contents":[
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@ body {
|
|||
}
|
||||
|
||||
.badge {
|
||||
display: none;
|
||||
padding: 14px;
|
||||
font-weight: bold;
|
||||
font-size: 32pt;
|
||||
|
|
|
@ -124,12 +124,31 @@ function setUpStrings(){
|
|||
// Is it checked?
|
||||
if (currentEl.checked){
|
||||
// Get the ID
|
||||
//choices[x].push(mappedIds[x][y]);
|
||||
choices[x].push(mappedIds[x][y]);
|
||||
score += quiz.reports[mappedIds[x][y]].points;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the grade
|
||||
let grade;
|
||||
if (score > quiz.threshold['a.min'])
|
||||
grade = 's';
|
||||
else if (score > quiz.threshold['b.min'])
|
||||
grade = 'a'
|
||||
else if (score > quiz.threshold['c.min'])
|
||||
grade = 'b'
|
||||
else if (score > quiz.threshold['d.min'])
|
||||
grade = 'c'
|
||||
else if (score > quiz.threshold['e.min'])
|
||||
grade = 'd'
|
||||
else if (score > quiz.threshold['b.min'])
|
||||
grade = 'e';
|
||||
else grade = 'f';
|
||||
|
||||
// Display the grade X badge element (unset its 'none' display value)
|
||||
document.getElementById('badge-' + grade).style['display'] = 'unset';
|
||||
|
||||
// Hide quiz and then show the results.
|
||||
quizEl.style['display'] = 'none';
|
||||
document.getElementById('results').style['display'] = 'unset';
|
||||
|
|
Reference in New Issue