From 5c30a974a68fdc5046b46be0f88df33c43a4124b Mon Sep 17 00:00:00 2001 From: Vivek Santayana Date: Wed, 31 Aug 2022 01:19:15 +0100 Subject: [PATCH] Added database actions in view --- server/app/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/app/views.py b/server/app/views.py index 2bf37bb..aa7de9b 100644 --- a/server/app/views.py +++ b/server/app/views.py @@ -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/')