Skip to content

Commit

Permalink
fix: filter was a bit incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
tuneerroy committed Nov 7, 2023
1 parent 196286f commit 38cd1bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/laundry/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ def get_snapshot_info(hall_id):
start = timezone.localtime().replace(hour=0, minute=0, second=0, microsecond=0)

# adds all the LaundrySnapshots from the same weekday within the previous 28 days
filter = Q(room=room)
filter = Q()
for week in range(4):
new_start = start - datetime.timedelta(weeks=week)
new_end = new_start + datetime.timedelta(hours=27)
filter |= Q(date__gt=new_start, date__lt=new_end)
filter |= Q(room=room, date__gt=new_start, date__lt=new_end)

snapshots = LaundrySnapshot.objects.filter(filter).order_by("-date")
return (room, snapshots)
Expand Down

0 comments on commit 38cd1bd

Please sign in to comment.