Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: Game class show fix (#1719)
Browse files Browse the repository at this point in the history
* fix: made games with no classes invisible

* fix: made games with no classes invisible

* remove print()
  • Loading branch information
KamilPawel authored Oct 27, 2022
1 parent 54355c8 commit 521ffc1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions aimmo/templatetags/players_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ def get_user_playable_games(context, base_url):
user = context.request.user
teacher = user.new_teacher
if logged_in_as_teacher(user):
playable_games = list(Game.objects.filter(owner=user, is_archived=False))
playable_games = list(Game.objects.filter(owner=user, is_archived=False).exclude(game_class=None))
if teacher.is_admin:
playable_games += list(
Game.objects.filter(game_class__teacher__school=teacher.school, is_archived=False).exclude(owner=user)
Game.objects.filter(game_class__teacher__school=teacher.school, is_archived=False)
# passing multiple args does not seem to work
.exclude(owner=user).exclude(game_class=None)
)
else:
playable_games = Game.objects.none()

return {
"user": user,
"base_url": base_url,
Expand Down

0 comments on commit 521ffc1

Please sign in to comment.