Added functionality for default datasets.

Incorporated dataset selector into test creation.
This commit is contained in:
2021-11-28 17:28:14 +00:00
parent e1967bcd7e
commit 2fce2e0c80
11 changed files with 350 additions and 85 deletions

View File

@ -37,7 +37,7 @@ def start():
user_code = None if user_code == '' else user_code
if not db.tests.find_one({'test_code': test_code}):
return jsonify({'error': 'The exam code you entered is invalid.'}), 400
attempt = {
entry = {
'_id': uuid4().hex,
'name': encrypt(name),
'email': encrypt(email),
@ -47,8 +47,8 @@ def start():
'start_time': datetime.utcnow(),
'status': 'started'
}
if db.results.insert(attempt):
return jsonify({ 'success': f'Exam started at started {attempt["start_time"].strftime("%H:%M:%S")}.' })
if db.entries.insert(entry):
return jsonify({ 'success': f'Exam started at started {entry["start_time"].strftime("%H:%M:%S")}.' })
else:
errors = [*form.errors]
return jsonify({ 'error': errors}), 400