Fix upload bug (astimezone)

This commit is contained in:
Daan Sprenkels
2018-11-08 11:51:41 +01:00
parent 5c495b17ef
commit 446b564a4b

View File

@ -323,13 +323,12 @@ def upload_stats(user):
@transaction.atomic
def _request_weight(ps):
def _is_regular_queue(ps):
ps = ps.astimezone()
if not ps.played_at:
# Request is from the old times, assume good
return True
if not 0 <= ps.played_at.weekday() <= 4:
if not 0 <= ps.played_at.astimezone().weekday() <= 4:
return False # Queued in the weekend
if not 7 <= ps.played_at.hour <= 22:
if not 7 <= ps.played_at.astimezone().hour <= 22:
# Because of timezone shit, I allow for an extra hour of leeway
return False # Queued outside of regular opening hours
return True