Skip to content

Commit

Permalink
time sensitive + cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLovesDoggo committed Dec 3, 2023
1 parent b2889e9 commit 22e8030
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

from core.models import Hunt
from django.conf import settings
from django.utils import timezone


def start(request):
hunt = Hunt.current_hunt()
now = timezone.now()
return dict(
START=(start := hunt.start),
START_BEFORE=start > datetime.datetime.utcnow(),
START_UNTIL=start - datetime.datetime.utcnow(),
START_BEFORE=start > now,
START_UNTIL=start - now,
END=(end := hunt.end),
END_BEFORE=end > datetime.datetime.utcnow(),
END_UNTIL=end - datetime.datetime.utcnow(),
END_BEFORE=end > now,
END_UNTIL=end - now,
)

0 comments on commit 22e8030

Please sign in to comment.