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