2 Commits 4bd495e1d7 ... c1318a91ab

Author SHA1 Message Date
  blezz-tech c1318a91ab reminder for tickets with status IN_PROCESS 2 weeks ago
  blezz-tech 4bd495e1d7 reminder for tickets with status IN_PROCESS 2 weeks ago
1 changed files with 8 additions and 8 deletions
  1. 8 8
      handlers/st_request_in_process.py

+ 8 - 8
handlers/st_request_in_process.py

@@ -24,7 +24,7 @@ DEFAULT_REMINDER_INTERVAL = 30 * 60  # 30 минут в секундах
 MAX_REMINDERS = 3  # Максимальное количество напоминаний
 DEFAULT_CHECK_INTERVAL = 5 * 60 # Проверка тикетов каждые 5 минут
  
-tickets = {}
+tickets_nt = {}
 
 def send_reminder(user, ticket):
     message = f"Напоминание: необходимо принять решение по тикету {ticket.id}"
@@ -50,21 +50,21 @@ def process_in_progress_ticket(ticket_list, start_time):
     tickets=jsreq.requestGetTicket_user(token, config.API_URL+f"tickets/api/ticket_list/{ticket_list.id}")
     for ticket in tickets:
         if ticket.status == 131:
-            if ticket.id in tickets:
-                tickets[ticket.id] = {
+            if ticket.id not in tickets:
+                tickets_nt[ticket.id] = {
                     "reminders": 0,
                     "last_date_reminder": start_time
                 }
             
-            if (start_time - tickets[ticket.id]["last_date_reminder"]) > DEFAULT_REMINDER_INTERVAL:
-                if IS_INFINITE_REMINDER or tickets[ticket.id]['reminders'] < MAX_REMINDERS:
+            if (start_time - tickets_nt[ticket.id]["last_date_reminder"]) > DEFAULT_REMINDER_INTERVAL:
+                if IS_INFINITE_REMINDER or tickets_nt[ticket.id]['reminders'] < MAX_REMINDERS:
                     send_reminder("st_request_in_process@ej.sharix-app.org", ticket)
                 else:
-                    del tickets[ticket.id] 
+                    del tickets_nt[ticket.id] 
                     # Функция смены статуса на WONTFIX
                 
-                tickets[ticket.id]["reminders"] += 1
-                tickets[ticket.id]["last_date_reminder"] += start_time
+                tickets_nt[ticket.id]["reminders"] += 1
+                tickets_nt[ticket.id]["last_date_reminder"] += start_time
 
 
 def status_changer():