Update stats/management/commands/fetch_stats.py
All checks were successful
Deploy Prod / Build (pull_request) Successful in 7s
Deploy Prod / Push (pull_request) Successful in 10s
Deploy Prod / Deploy prod (pull_request) Successful in 14s

This commit is contained in:
emmatveev 2024-12-02 15:13:32 +03:00
parent ed33722449
commit 7238b50ee6

View File

@ -24,6 +24,8 @@ class Command(BaseCommand):
if response.status_code != 200:
continue
Snapshot.objects.create(project=project, data=response.json())
if not project.stats_cron:
continue
cron = croniter.croniter(project.stats_cron, timezone.now())
next_date = cron.get_next(datetime.datetime)
project.next_stats_fetch_time = next_date