Added individual result correct/incorrect flag
This commit is contained in:
parent
9988a989a6
commit
389fbf99aa
@ -141,6 +141,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ answer }}
|
{{ answer }}
|
||||||
|
{% if not correct[question] == answer %}
|
||||||
|
<span class="badge badge-pill bg-danger badge-danger">Incorrect</span>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -223,3 +223,14 @@ def get_datasets():
|
|||||||
}
|
}
|
||||||
data.append(data_element)
|
data.append(data_element)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def get_correct_answers(dataset:dict):
|
||||||
|
output = {}
|
||||||
|
blocks = dataset['questions']
|
||||||
|
for block in blocks:
|
||||||
|
if block['type'] == 'question':
|
||||||
|
output[str(block['q_no'])] = block['options'][block['correct']]
|
||||||
|
if block['type'] == 'block':
|
||||||
|
for question in block['questions']:
|
||||||
|
output[str(question['q_no'])] = question['options'][question['correct']]
|
||||||
|
return output
|
@ -75,7 +75,7 @@ def start():
|
|||||||
'test_code': test_code,
|
'test_code': test_code,
|
||||||
'user_code': user_code
|
'user_code': user_code
|
||||||
}
|
}
|
||||||
if db.entries.insert(entry):
|
if db.entries.insert_one(entry):
|
||||||
session['_id'] = entry['_id']
|
session['_id'] = entry['_id']
|
||||||
return jsonify({
|
return jsonify({
|
||||||
'success': 'Received and validated test and/or user code. Redirecting to test client.',
|
'success': 'Received and validated test and/or user code. Redirecting to test client.',
|
||||||
|
Loading…
Reference in New Issue
Block a user