Added functionality for default datasets.
Incorporated dataset selector into test creation.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user