2 Commits b0e89fbc83 ... bf277f4fd0

Author SHA1 Message Date
  blezz-tech bf277f4fd0 reminder for tickets with status IN_PROCESS 2 weeks ago
  blezz-tech b0e89fbc83 reminder for tickets with status IN_PROCESS 2 weeks ago
1 changed files with 20 additions and 20 deletions
  1. 20 20
      handlers/st_request_in_process.py

+ 20 - 20
handlers/st_request_in_process.py

@@ -46,30 +46,30 @@ def send_wontfix_notification(user, ticket):
     print(f"Отправлено уведомление пользователю {user} о WONTFIX для тикета {ticket.id}")
 
 def ticket_worker(ticket, start_time):
-    if ticket.status == 131:
-        if ticket.id not in tickets_nt:
-            tickets_nt[ticket.id] = {
-                "reminders": 0,
-                "last_date_reminder": start_time
-            }
-
-        dtime_notification = start_time - tickets_nt[ticket.id]["last_date_reminder"]
-
-        if dtime_notification.seconds > DEFAULT_REMINDER_INTERVAL:
-            tickets_nt[ticket.id]["reminders"] += 1
-            tickets_nt[ticket.id]["last_date_reminder"] = start_time
-
-            if IS_INFINITE_REMINDER or tickets_nt[ticket.id]['reminders'] <= MAX_REMINDERS:
-                send_reminder_notification("TEST_USER", ticket)
-            else:
-                del tickets_nt[ticket.id]
-                jsreq.requestPatchTicketUser(token, config.API_URL+f"tickets/api/ticket/{ticket.id}/status", { "status": 149 })
-                send_wontfix_notification("TEST_USER", ticket)
+    if ticket.id not in tickets_nt:
+        tickets_nt[ticket.id] = {
+            "reminders": 0,
+            "last_date_reminder": start_time
+        }
+
+    dtime_notification = start_time - tickets_nt[ticket.id]["last_date_reminder"]
+
+    if dtime_notification.seconds > DEFAULT_REMINDER_INTERVAL:
+        tickets_nt[ticket.id]["reminders"] += 1
+        tickets_nt[ticket.id]["last_date_reminder"] = start_time
+
+        if IS_INFINITE_REMINDER or tickets_nt[ticket.id]['reminders'] <= MAX_REMINDERS:
+            send_reminder_notification("TEST_USER", ticket)
+        else:
+            del tickets_nt[ticket.id]
+            jsreq.requestPatchTicketUser(token, config.API_URL+f"tickets/api/ticket/{ticket.id}/status", { "status": 149 })
+            send_wontfix_notification("TEST_USER", ticket)
 
 def ticket_list_worker(ticket_list, start_time):
     tickets=jsreq.requestGetTicket_user(token, config.API_URL+f"tickets/api/ticket_list/{ticket_list.id}")
     for ticket in tickets:
-        ticket_worker(ticket, start_time)
+        if ticket.status == 131:
+            ticket_worker(ticket, start_time)
 
 def status_changer():
     while True: