Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
urchinpro committed Jun 7, 2024
1 parent a08402f commit 998a65a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions integration_framework/send_messages/views.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)

Expand All @@ -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)
Expand Down

0 comments on commit 998a65a

Please sign in to comment.