Skip to content

Commit

Permalink
use hex_dojo_id instead of reference_id to line up with DojoChallenge
Browse files Browse the repository at this point in the history
  • Loading branch information
zardus committed Jan 23, 2024
1 parent 00d9c94 commit 3781eca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dojo_plugin/api/v1/dojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ class PruneAwards(Resource):
def post(self, dojo):
all_completions = set(user for user,_ in dojo.completions())
num_pruned = 0
for award in Emojis.query.where(Emojis.category==dojo.reference_id):
for award in Emojis.query.where(Emojis.category==dojo.hex_dojo_id):
if award.user not in all_completions:
num_pruned += 1
db.session.delete(award)
db.session.commit()
return {"success": True, "pruned_awards": num_pruned, "all_completions": str(all_completions)}
return {"success": True, "pruned_awards": num_pruned}

@dojo_namespace.route("/<dojo>/promote-admin")
class PromoteAdmin(Resource):
Expand Down
4 changes: 2 additions & 2 deletions dojo_plugin/api/v1/scoreboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_scoreboard_page(model, duration=None, page=1, per_page=20):
pagination = Pagination(None, page, per_page, len(results), results[start_idx:end_idx])
user = get_current_user()

viewable_dojos = { dojo.reference_id for dojo in Dojos.viewable(user=user) }
viewable_dojos = { dojo.hex_dojo_id:dojo for dojo in Dojos.viewable(user=user) }
emojis = { }
for emoji in Emojis.query.order_by(Emojis.date).all():
if emoji.category not in viewable_dojos:
Expand All @@ -101,7 +101,7 @@ def get_scoreboard_page(model, duration=None, page=1, per_page=20):
"text": emoji.description,
"emoji": emoji.name,
"count": 1,
"url": url_for("pwncollege_dojo.listing", dojo=emoji.category)
"url": url_for("pwncollege_dojo.listing", dojo=viewable_dojos[emoji.category])
})

def standing(item):
Expand Down
2 changes: 1 addition & 1 deletion dojo_plugin/utils/awards.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_user_emojis(user):
if not emoji:
continue
if dojo.completed(user):
emojis.append((emoji, dojo.name, dojo.reference_id))
emojis.append((emoji, dojo.name, dojo.hex_dojo_id))
return emojis

def get_belts():
Expand Down

0 comments on commit 3781eca

Please sign in to comment.