Updated test expiry
This commit is contained in:
		@@ -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'])
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user