Merge pull request 'Update stats/management/commands/fetch_stats.py' (#13) from master into prod

Reviewed-on: #13
This commit is contained in:
emmatveev 2024-12-02 15:13:51 +03:00
commit eec0828dda

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