diff --git a/marietje/api/views.py b/marietje/api/views.py index 04b48c7..5d225bd 100644 --- a/marietje/api/views.py +++ b/marietje/api/views.py @@ -255,10 +255,10 @@ def upload(request): # Score function: # - U = duration * songs uploaded # - Q = duration * songs queued - # - If 3*U < Q: allow upload (otherwise don't) + # - If 2*U < Q: allow upload (otherwise don't) try: stats = upload_stats(request.user) - ratio = stats['queued_score'] / (3.0 * stats['upload_score']) + ratio = stats['queued_score'] / (2.0 * stats['upload_score']) ratiostr = '{:.2f}'.format(ratio) except ZeroDivisionError: ratio = 99999.0 # high enough @@ -323,12 +323,14 @@ 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.weekday() <= 4: return False # Queued in the weekend - if not 8 <= ps.played_at.hour <= 21: + if not 7 <= ps.played_at.hour <= 22: + # Because of timezone shit, I allow for an extra hour of leeway return False # Queued outside of regular opening hours return True