From 0c853fbbfb2818d1deeac91735da1304ff6c7504 Mon Sep 17 00:00:00 2001 From: zakhy Date: Mon, 2 Sep 2024 09:16:25 +0700 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=B1=D0=BE?= =?UTF-8?q?=D0=BB=D0=B5=D0=B5=20=D0=BD=D0=B5=20=D0=BD=D1=83=D0=B6=D0=BD?= =?UTF-8?q?=D1=83=D1=8E=20=D0=B7=D0=B0=D0=B4=D0=B0=D1=87=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/apps/main/tasks.py | 26 -------------------------- app/repcofkk/celery.py | 4 ---- 2 files changed, 30 deletions(-) diff --git a/app/apps/main/tasks.py b/app/apps/main/tasks.py index 1e94e20..f8990b9 100644 --- a/app/apps/main/tasks.py +++ b/app/apps/main/tasks.py @@ -35,32 +35,6 @@ def get_scales_data_from_redis(tag: str = get_settings('control_conveyor')): return {'value': value, 'date': date} -@shared_task -def create_start_shift_worktime(): - """ - Description: - Создает копию FabricWorkTime под время начала смены. - Вызывается в 8:00 и 20:00 - Returns: - - """ - scales_data = get_scales_data_from_redis() - now_date = DashboardBaseService.get_current_time() - shift_start = DashboardBaseService.get_shift_start(now_date) - delta = (now_date - scales_data['date']).total_seconds() / 60 - - try: - latest_worktime_obj = FabricWorkTime.objects.latest('time') - except FabricWorkTime.DoesNotExist: - latest_worktime_obj = FabricWorkTime.objects.create( - time=scales_data['date'], - status='WO' if delta < 5 else 'NW' - ) - - created_record = FabricWorkTime.objects.create(time=shift_start, status=latest_worktime_obj.status) - return f'Success. Created start shift record {str(created_record)}' - - @shared_task def create_worktime_data(): """ diff --git a/app/repcofkk/celery.py b/app/repcofkk/celery.py index 0245dd9..c8f3d26 100644 --- a/app/repcofkk/celery.py +++ b/app/repcofkk/celery.py @@ -31,8 +31,4 @@ app.conf.beat_schedule = { 'task': 'apps.main.tasks.create_shift_report', 'schedule': crontab(hour='7,19', minute=50), }, - 'shift_start_worktime': { - 'task': 'apps.main.tasks.create_start_shift_worktime', - 'schedule': crontab(hour='8,20', minute=0) - } }