Clear standings on award creation and deletion (#1035)

* Clear standings on award creation and deletion
This commit is contained in:
Kevin Chung
2019-06-22 19:02:27 -07:00
committed by GitHub
parent 97f52756bc
commit 6eb0d1ea34

View File

@@ -1,5 +1,6 @@
from flask import request
from flask_restplus import Namespace, Resource
from CTFd.cache import clear_standings
from CTFd.models import db, Awards
from CTFd.schemas.awards import AwardSchema
from CTFd.utils.decorators import admins_only
@@ -24,6 +25,9 @@ class AwardList(Resource):
response = schema.dump(response.data)
db.session.close()
# Delete standings cache because awards can change scores
clear_standings()
return {"success": True, "data": response.data}
@@ -46,4 +50,7 @@ class Award(Resource):
db.session.commit()
db.session.close()
# Delete standings cache because awards can change scores
clear_standings()
return {"success": True}