mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 14:34:21 +01:00
Clear standings on award creation and deletion (#1035)
* Clear standings on award creation and deletion
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
from flask import request
|
from flask import request
|
||||||
from flask_restplus import Namespace, Resource
|
from flask_restplus import Namespace, Resource
|
||||||
|
from CTFd.cache import clear_standings
|
||||||
from CTFd.models import db, Awards
|
from CTFd.models import db, Awards
|
||||||
from CTFd.schemas.awards import AwardSchema
|
from CTFd.schemas.awards import AwardSchema
|
||||||
from CTFd.utils.decorators import admins_only
|
from CTFd.utils.decorators import admins_only
|
||||||
@@ -24,6 +25,9 @@ class AwardList(Resource):
|
|||||||
response = schema.dump(response.data)
|
response = schema.dump(response.data)
|
||||||
db.session.close()
|
db.session.close()
|
||||||
|
|
||||||
|
# Delete standings cache because awards can change scores
|
||||||
|
clear_standings()
|
||||||
|
|
||||||
return {"success": True, "data": response.data}
|
return {"success": True, "data": response.data}
|
||||||
|
|
||||||
|
|
||||||
@@ -46,4 +50,7 @@ class Award(Resource):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
db.session.close()
|
db.session.close()
|
||||||
|
|
||||||
|
# Delete standings cache because awards can change scores
|
||||||
|
clear_standings()
|
||||||
|
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
|
|||||||
Reference in New Issue
Block a user