mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 12:22:21 +01:00
Fix upload bug (astimezone)
This commit is contained in:
@ -323,13 +323,12 @@ def upload_stats(user):
|
|||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def _request_weight(ps):
|
def _request_weight(ps):
|
||||||
def _is_regular_queue(ps):
|
def _is_regular_queue(ps):
|
||||||
ps = ps.astimezone()
|
|
||||||
if not ps.played_at:
|
if not ps.played_at:
|
||||||
# Request is from the old times, assume good
|
# Request is from the old times, assume good
|
||||||
return True
|
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
|
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
|
# Because of timezone shit, I allow for an extra hour of leeway
|
||||||
return False # Queued outside of regular opening hours
|
return False # Queued outside of regular opening hours
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user