Added database actions in view
This commit is contained in:
parent
713c6beb48
commit
5c30a974a6
@ -1,3 +1,4 @@
|
||||
from .models import Entry
|
||||
from .tools.data import check_file, load
|
||||
from .tools.quiz import compile_results, evaluate_answers, render_questions
|
||||
|
||||
@ -20,6 +21,8 @@ def _submit():
|
||||
answers = request.json
|
||||
scores = evaluate_answers(answers)
|
||||
results = compile_results(results=scores)
|
||||
new_entry = Entry(answers=answers, results=results)
|
||||
new_entry.add()
|
||||
return jsonify(results)
|
||||
|
||||
@views.route('/results/')
|
||||
|
Loading…
Reference in New Issue
Block a user