Prevent accidental double unlocks (#1315)

* Prevent a hint from being unlocked twice
* Closes  #1301
This commit is contained in:
Kevin Chung
2020-04-11 22:03:51 -04:00
committed by GitHub
parent 96f317293f
commit 04e6b2011f
2 changed files with 31 additions and 0 deletions

View File

@@ -59,6 +59,16 @@ class UnlockList(Resource):
if response.errors:
return {"success": False, "errors": response.errors}, 400
existing = Unlocks.query.filter_by(**req).first()
if existing:
return (
{
"success": False,
"errors": {"target": "You've already unlocked this this target"},
},
400,
)
db.session.add(response.data)
award_schema = AwardSchema()