Skip to content

Commit

Permalink
single list comprehension instead of two
Browse files Browse the repository at this point in the history
  • Loading branch information
holohup committed Apr 3, 2024
1 parent 555bc44 commit 855b176
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions backend/utils/achievements.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,11 @@ def __init__(self, user, ios_achievements: List[int] = None, history: History =
self._history = history
self._new_achievements = []
self._unfinished_achievements = None
self._new_ios_achievements = None
if ios_achievements is not None and isinstance(ios_achievements, list):
ios_int_ids = [int(ios_achievement) for ios_achievement in ios_achievements]
self._new_ios_achievements = [
Achievement.objects.get(id=_id) for _id in ios_int_ids if _id in IOS_ACHIEVEMENTS
Achievement.objects.get(id=_id) for _id in map(int, ios_achievements) if _id in IOS_ACHIEVEMENTS
]
else:
self._new_ios_achievements = None

def update_achievements(self):
self._query_unfinished_achievements()
Expand Down

0 comments on commit 855b176

Please sign in to comment.