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) - } }