Added server and admin-side time limit adjustments
This commit is contained in:
@ -41,13 +41,14 @@ class Test:
|
||||
return jsonify({'error': f'Could not create exam. An error occurred.'}), 400
|
||||
|
||||
def add_time_adjustment(self, time_adjustment):
|
||||
code = {
|
||||
adjustment = {
|
||||
'_id': uuid4().hex,
|
||||
'user_code': secrets.token_hex(2).upper(),
|
||||
'user_code': secrets.token_hex(3).upper(),
|
||||
'time_adjustment': time_adjustment
|
||||
}
|
||||
if db.tests.find_one_and_update({'_id': self._id}, {'$push': {'time_adjustments': code}},upsert=False):
|
||||
return jsonify({'success': code})
|
||||
if db.tests.find_one_and_update({'_id': self._id}, {'$push': {'time_adjustments': adjustment}},upsert=False):
|
||||
flash(f'Time adjustment for {adjustment["time_adjustment"]} minutes has been added. This can be enabled using the user code {adjustment["user_code"]}.')
|
||||
return jsonify({'success': adjustment})
|
||||
return jsonify({'error': 'Failed to add the time adjustment. An error occurred.'}), 400
|
||||
|
||||
def remove_time_adjustment(self, _id):
|
||||
|
Reference in New Issue
Block a user