2 Комити 7100af483b ... a64130dc6d

Аутор SHA1 Порука Датум
  blezz-tech a64130dc6d reminder for tickets with status IN_PROCESS пре 2 недеља
  blezz-tech 7100af483b reminder for tickets with status IN_PROCESS пре 2 недеља
1 измењених фајлова са 17 додато и 17 уклоњено
  1. 17 17
      handlers/st_request_in_process.py

+ 17 - 17
handlers/st_request_in_process.py

@@ -46,34 +46,34 @@ def send_wontfix_notification(user, ticket):
 
 
 
-def process_in_progress_ticket(ticket, start_time):
-    tickets_new=jsreq.requestGetTicket_user(token, config.API_URL+f"tickets/api/ticket_list/{ticket.id}")
-    for ticket_new in tickets_new:
-        if ticket_new.status == 131:
-            if ticket_new.id in tickets:
-                tickets[ticket_new.id] = {
+def process_in_progress_ticket(ticket_list, start_time):
+    tickets=jsreq.requestGetTicket_user(token, config.API_URL+f"tickets/api/ticket_list/{ticket.id}")
+    for ticket in tickets:
+        if ticket.status == 131:
+            if ticket.id in tickets:
+                tickets[ticket.id] = {
                     "reminders": 0,
                     "last_date_reminder": start_time
                 }
             
-            if IS_INFINITE_REMINDER or tickets[ticket_new.id]['reminders'] < MAX_REMINDERS:
-                if (start_time - tickets[ticket_new.id]["last_date_reminder"]) > DEFAULT_REMINDER_INTERVAL:
-                    send_reminder("st_request_in_process@ej.sharix-app.org", ticket_new)
-
-                    tickets[ticket_new.id]["reminders"] += 1
-                    tickets[ticket_new.id]["last_date_reminder"] += start_time
-            elif not IS_INFINITE_REMINDER and tickets[ticket_new.id]['reminders'] >= MAX_REMINDERS:
-                del tickets[ticket_new.id] 
+            if IS_INFINITE_REMINDER or tickets[ticket.id]['reminders'] < MAX_REMINDERS:
+                if (start_time - tickets[ticket.id]["last_date_reminder"]) > DEFAULT_REMINDER_INTERVAL:
+                    send_reminder("st_request_in_process@ej.sharix-app.org", ticket)
+
+                    tickets[ticket.id]["reminders"] += 1
+                    tickets[ticket.id]["last_date_reminder"] += start_time
+            elif not IS_INFINITE_REMINDER and tickets[ticket.id]['reminders'] >= MAX_REMINDERS:
+                del tickets[ticket.id] 
                 # Функция смены статуса на WONTFIX
 
 
 def status_changer():
     while True:
-        ticketlist = jsreq.requestGetList(token, config.API_URL + "tickets/api/ticket_list/")
-        for ticket in ticketlist:
+        ticketlists = jsreq.requestGetList(token, config.API_URL + "tickets/api/ticket_list/")
+        for ticketlist in ticketlists:
             start_time = datetime.now()
             bot.bot_log(f"{botname} {start_time.strftime('%Y-%m-%d')} Тикет {ticket.id} в обработке\n")
-            t1 = threading.Thread(target=process_in_progress_ticket, args=(ticket, start_time))
+            t1 = threading.Thread(target=process_in_progress_ticket, args=(ticketlist, start_time))
             t1.start()
             t1.join()  # Ожидаем завершения обработки тикета
         time.sleep(DEFAULT_CHECK_INTERVAL)