Skip to content

Commit

Permalink
Fix error occurring when there is no collection attached to a team
Browse files Browse the repository at this point in the history
  • Loading branch information
U039b committed Jan 8, 2024
1 parent 653194c commit 7979ea0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions video_downloading_platform/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ def get_users_open_batches(user):
teams = BatchTeam.get_my_teams_as_contrib(user).all()
for team in teams:
batch = team.batch.first()
_batches.append(batch.id)
if batch:
_batches.append(batch.id)
_batches.extend([b.id for b in Batch._get_users_batches(user, Batch.OPEN).all()])
return Batch.objects.filter(id__in=_batches)

Expand All @@ -275,7 +276,7 @@ def _get_users_batches(user, status):
teams = BatchTeam.get_my_teams_as_contrib(user).all()
for team in teams:
batch = team.batch.first()
if batch.status == status:
if batch and batch.status == status:
_batches.append(batch.id)
_batches.extend([b.id for b in Batch.objects.filter(owner=user, status=status).all()])
_batches = list(set(_batches))
Expand Down

0 comments on commit 7979ea0

Please sign in to comment.