update docker deployment and changing seed kandang name
This commit is contained in:
1 parent
76f4d0106a
commit
74dd3faf60
40 files changed
+1253
-122
No files matched your search
@@ -0,0 +1,29 @@
|
||||
"""Dashboard publish cutoff — day D data visible from 17:00 WIB on day D."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date, datetime, time, timedelta
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
def dashboard_publish_time() -> time:
|
||||
hour = int(getattr(settings, "DASHBOARD_PUBLISH_HOUR", 17))
|
||||
minute = int(getattr(settings, "DASHBOARD_PUBLISH_MINUTE", 0))
|
||||
return time(hour, minute)
|
||||
|
||||
|
||||
def visible_through_date(now: datetime | None = None) -> date:
|
||||
"""Latest calendar date (WIB) allowed on dashboard reads."""
|
||||
if now is None:
|
||||
now = timezone.localtime()
|
||||
elif timezone.is_naive(now):
|
||||
now = timezone.make_aware(now, timezone.get_current_timezone())
|
||||
else:
|
||||
now = timezone.localtime(now)
|
||||
|
||||
today = now.date()
|
||||
if now.time() < dashboard_publish_time():
|
||||
return today - timedelta(days=1)
|
||||
return today
|
||||
Reference in new issue
Block a user