Updated test expiry
This commit is contained in:
parent
ede2ff5355
commit
31b3d5b170
@ -421,8 +421,8 @@ def delete_test():
|
||||
def close_test():
|
||||
from main import db
|
||||
_id = request.get_json()['_id']
|
||||
if db.tests.find_one_and_update({'_id': _id}, {'$set': {'expiry_date': datetime.today() - timedelta(days=1) }}):
|
||||
return Test(_id = _id).delete()
|
||||
if db.tests.find_one({'_id': _id}):
|
||||
return Test(_id = _id, expiry_date= datetime.today() - timedelta(days=1)).update()
|
||||
return jsonify({'error': 'Could not find the corresponding test to delete.'}), 404
|
||||
|
||||
@views.route('/test/<_id>/', methods=['GET','POST'])
|
||||
|
Loading…
Reference in New Issue
Block a user