Skip to content

Commit

Permalink
* last second cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
uraniumanchor committed Dec 6, 2023
1 parent ec8f12f commit 0b4b33a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 20 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ def get_package_name(name):
'celery~=5.0',
'channels>=2.0',
'Django>=3.2,!=4.0.*,<4.3',
'django-ajax-selects~=2.2',
'django-ajax-selects~=2.1', # publish error, see: https://github.com/crucialfelix/django-ajax-selects/issues/306
'django-ical~=1.7',
'django-mptt~=0.10',
'django-paypal~=1.1',
'django-post-office~=3.2',
'django-timezone-field>=3.1,<7.0',
'djangorestframework~=3.9',
'python-dateutil~=2.8.1', # TODO: remove when 3.11 is oldest supported version
'python-dateutil~=2.8.1;python_version<"3.11"',
'requests>=2.27.1,<2.32.0',
],
python_requires='>=3.7, <3.12',
Expand Down
3 changes: 2 additions & 1 deletion tests/apiv2/test_donations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import random
from datetime import datetime, timedelta
from typing import Optional

from django.contrib.admin.models import CHANGE
from django.contrib.auth.models import Permission, User
Expand Down Expand Up @@ -30,7 +31,7 @@ def generate_donations(
count=1,
state: str,
transactionstate='COMPLETED',
time: datetime = None,
time: Optional[datetime] = None,
):
commentstate = 'PENDING'
readstate = 'PENDING'
Expand Down
4 changes: 1 addition & 3 deletions tests/randgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,7 @@ def build_random_event(

event = generate_event(rand, start_time=start_time)
if not start_time:
start_time = datetime.datetime.combine(event.date, datetime.time()).replace(
tzinfo=datetime.timezone.utc
)
start_time = datetime.datetime.combine(event.date, utcnow().timetz())
event.save()

list_of_runs = generate_runs(rand, event=event, num_runs=num_runs, scheduled=True)
Expand Down
5 changes: 2 additions & 3 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
celery==5.2.7
channels==3.0.4
# django explicitly not listed here because azure installs a particular series immediately after
django-ajax-selects==2.2.0
django-ajax-selects==2.1.0 # publish error, see: https://github.com/crucialfelix/django-ajax-selects/issues/306
django-ical==1.9.2
django-paypal==1.1.2
django-mptt==0.14.0
django-post-office==3.6.0
django-timezone-field==6.1.0
djangorestframework==3.14.0
backports.zoneinfo==0.2.1 ; python_version<"3.9"
# TODO: can be removed when 3.11 is oldest supported version
python-dateutil==2.8.2
python-dateutil==2.8.2 ; python_verson<"3.11"
# can be removed when either 3.7 is not supported or once we upgrade Celery
importlib_metadata==4.13.0 ; python_version<"3.8"
pre-commit==3.5.0 ; python_version>="3.8"
Expand Down
10 changes: 1 addition & 9 deletions tracker/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
from .fields import TimestampField
from .util import LatestEvent

# TODO: remove when 3.9 is oldest supported version

try:
import zoneinfo
except ImportError:
from backports import zoneinfo

# TODO: remove when 3.10 is oldest supported version

try:
Expand All @@ -49,7 +42,6 @@ def pairwise(iterable):
'Headset',
]

_timezoneChoices = [(x, x) for x in zoneinfo.available_timezones()]
_currencyChoices = (('USD', 'US Dollars'), ('CAD', 'Canadian Dollars'))


Expand Down Expand Up @@ -401,7 +393,7 @@ def upcoming(
elif isinstance(now, str):
now = datetime.datetime.fromisoformat(now)
elif isinstance(now, datetime.datetime):
now = now.astimezone(datetime.timezone.utc)
pass # no adjustment necessary
else:
raise ValueError(f'Expected None, str, or datetime, got {type(now)}')
if include_current:
Expand Down
4 changes: 2 additions & 2 deletions tracker/models/prize.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,9 @@ def start_draw_time(self):
return self.prev_run.endtime - datetime.timedelta(
milliseconds=self.prev_run.setup_time_ms
)
return self.startrun.starttime.replace(tzinfo=datetime.timezone.utc)
return self.startrun.start_time_utc
elif self.starttime:
return self.starttime.replace(tzinfo=datetime.timezone.utc)
return self.start_time_utc
else:
return None

Expand Down

0 comments on commit 0b4b33a

Please sign in to comment.