Skip to content

Commit

Permalink
remove unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
hasan-sh committed May 29, 2024
1 parent 706635c commit 283fc33
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions website/public_adventures.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ def __init__(self, db: Database, achievements: Achievements):

self.db = db
self.achievements = achievements
self.adventures = {}
self.customizations = {"available_levels": set()}
self.available_languages = set()
self.available_tags = set()

@route("/", methods=["GET"])
@route("/filter", methods=["PUT"])
Expand Down Expand Up @@ -230,28 +226,5 @@ def clone_adventure(self, user, adventure_id):
self.db.update_public_adventure_filters_indexes(adventure)
self.db.store_adventure(adventure)

# update cloned adv. that's saved in this class
for _level in current_adventure.get("levels", [level]):
_level = int(_level)
for i, adv in enumerate(self.adventures.get(_level, [])):
if adv.get("id") == current_adventure.get("id"):
adventure["short_name"] = adventure.get("name")
adventure["text"] = adventure.get("content")
# Replace the old adventure with the new adventure
self.adventures[_level][i] = adventure
break
# TODO: add achievement
return render_partial('htmx-adventure-card.html', user=user, adventure=adventure, level=level,)

def update_filters(self, adventures, to_filter):
if to_filter == 'lang':
self.available_languages = set()
else:
self.available_tags = set()
for adventure in adventures:
if to_filter == 'lang':
adv_lang = adventure.get("language", g.lang)
self.available_languages.update([adv_lang])
else:
adv_tags = adventure.get("tags", [])
self.available_tags.update(adv_tags)

0 comments on commit 283fc33

Please sign in to comment.