From 84d227a8a20624c0efeb9b9f86aa4ac05d9dc238 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 27 Apr 2018 16:21:49 +0300 Subject: [PATCH] stat part 1 --- lms/celery.py | 8 ++++---- progress/tasks.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lms/celery.py b/lms/celery.py index 673ac8f..361ae63 100644 --- a/lms/celery.py +++ b/lms/celery.py @@ -24,10 +24,10 @@ app.conf.beat_schedule = { 'schedule': crontab(minute='0', hour='*/3',), 'task': 'finance.tasks.periodic_billing' }, - 'statistic_teachers': { - 'schedule': crontab(hour='16', minute='0'), - 'task': 'progress.tasks.statistic_teachers' - } + # 'statistic_teachers': { + # 'schedule': crontab(hour='16', minute='0'), + # 'task': 'progress.tasks.statistic_teachers' + # } } diff --git a/progress/tasks.py b/progress/tasks.py index e62ee89..9e3e5cb 100644 --- a/progress/tasks.py +++ b/progress/tasks.py @@ -41,7 +41,7 @@ def add_next_lesson(progress): def statistic_teachers(): file_dir = "%s/analytics/teachers/" % (settings.MEDIA_ROOT,) os.makedirs(os.path.dirname(file_dir), exist_ok=True) - path = '%s%s' % (file_dir, timezone.now().strftime('%Y-%m-%d__%H-%M')) + path = '%s%s.csv' % (file_dir, timezone.now().strftime('%Y-%m-%d__%H-%M')) progresses = ProgressLesson.objects.filter(status='wait') @@ -61,7 +61,7 @@ def statistic_teachers(): for j in range(7): from_d = timezone.now() - relativedelta(days=(7 - j)) to_d = timezone.now() - relativedelta(days=(6 - j)) - row.append(progresses_sub.filter(last_update__gte=to_d, last_update__lt=from_d).count()) + row.append(progresses_sub.filter(last_update__gte=from_d, last_update__lt=to_d).count()) csv_writer.writerow(row)