mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Fix issue where hint with a free requirement could not be unlocked (#2107)
* Fix issue where hint with a free requirement could not be unlocked * Fix issue with referring to the right hint id
This commit is contained in:
@@ -125,7 +125,14 @@ class Hint(Resource):
|
||||
|
||||
# Get the IDs of all hints that the user has unlocked
|
||||
all_unlocks = HintUnlocks.query.filter_by(account_id=user.account_id).all()
|
||||
unlock_ids = {unlock.id for unlock in all_unlocks}
|
||||
unlock_ids = {unlock.target for unlock in all_unlocks}
|
||||
|
||||
# Get the IDs of all free hints
|
||||
free_hints = Hints.query.filter_by(cost=0).all()
|
||||
free_ids = {h.id for h in free_hints}
|
||||
|
||||
# Add free hints to unlocked IDs
|
||||
unlock_ids.update(free_ids)
|
||||
|
||||
# Filter out hint IDs that don't exist
|
||||
all_hint_ids = {h.id for h in Hints.query.with_entities(Hints.id).all()}
|
||||
|
||||
Reference in New Issue
Block a user