Skip to content

Commit

Permalink
refactor a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
tuneerroy committed Nov 6, 2023
1 parent 03fc86d commit d1902a2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions backend/laundry/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_snapshot_info(hall_id):
end = start + datetime.timedelta(hours=27)
filter |= Q(date__gt=start, date__lte=end)

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

def compute_usage(hall_id):
Expand All @@ -92,13 +92,8 @@ def compute_usage(hall_id):

for snapshot in snapshots:
date = snapshot.date.astimezone()

if date < min_date:
min_date = date

if date > max_date:
max_date = date

min_date = min(min_date, date)
max_date = max(max_date, date)
hour = date.hour

# accounts for the 3 hours on the next day
Expand Down

0 comments on commit d1902a2

Please sign in to comment.