Skip to content

Commit

Permalink
Use a list comprehension instead of this weird nested filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
colons committed Oct 18, 2023
1 parent 9e91081 commit bdc49b3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions nkdsu/apps/vote/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,11 @@ def shortlisted(self) -> list[Track]:

@memoize
def discarded(self) -> list[Track]:
return list(
filter(
lambda t: t not in self.playlist(),
(p.track for p in self.discard_set.all()),
)
)
playlist = self.playlist()
return [
p.track for p in self.discard_set.all()
if p.track not in playlist
]

@memoize
@pk_cached(20)
Expand Down

0 comments on commit bdc49b3

Please sign in to comment.