From 998a65a6bb9a48d31a9af32d1bca21fb8924aade Mon Sep 17 00:00:00 2001 From: sergei kasianenko Date: Fri, 7 Jun 2024 15:30:34 +0800 Subject: [PATCH] fix --- integration_framework/send_messages/views.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/integration_framework/send_messages/views.py b/integration_framework/send_messages/views.py index 8c64b27ef8..0f8a7edf7f 100644 --- a/integration_framework/send_messages/views.py +++ b/integration_framework/send_messages/views.py @@ -1,11 +1,9 @@ -import simplejson as json from dateutil.relativedelta import relativedelta from rest_framework.response import Response from api.directions.sql_func import get_confirm_direction_by_hospital from appconf.manager import SettingManager from hospitals.models import Hospitals -from integration_framework.researches.sql_func import get_confirm_research from laboratory.utils import current_time, TZ from rest_framework.decorators import api_view @@ -15,7 +13,7 @@ def get_directions_for_mail_send(request): if not hasattr(request.user, "hospitals"): return Response({"ok": False, "message": "Некорректный auth токен"}) - days_ago = SettingManager.get("days_before_hosp", default='30', default_type='i') + days_ago = SettingManager.get("days_before_hosp", default="30", default_type="i") d_end_time = current_time() d_start_time = d_end_time + relativedelta(days=-days_ago) @@ -24,8 +22,8 @@ def get_directions_for_mail_send(request): hospital_send_mail = Hospitals.hospitals_need_send_result_mail() hospitals_ids = tuple([i.get("id") for i in hospital_send_mail]) - result = get_confirm_direction_by_hospital(hospitals_ids, d_start, d_end, email_with_results_sent_is_false='1') - hosp_structure_by_id = {k.get("id"): {"send_after_time_min": k.get("send_after_time_min"), "mail": k.get('mail'), "dirs": []} for k in hospital_send_mail} + result = get_confirm_direction_by_hospital(hospitals_ids, d_start, d_end, email_with_results_sent_is_false="1") + hosp_structure_by_id = {k.get("id"): {"send_after_time_min": k.get("send_after_time_min"), "mail": k.get("mail"), "dirs": []} for k in hospital_send_mail} for r in result: last_confirm_time = r.last_confirmed_at.astimezone(TZ)