2 Commits e9a7e5d5e9 ... 7c99cad5ea

Author SHA1 Message Date
  blezz-tech 7c99cad5ea reminder for tickets with status IN_PROCESS 2 weeks ago
  blezz-tech e9a7e5d5e9 reminder for tickets with status IN_PROCESS 2 weeks ago
1 changed files with 11 additions and 9 deletions
  1. 11 9
      handlers/st_request_in_process.py

+ 11 - 9
handlers/st_request_in_process.py

@@ -21,12 +21,12 @@ proceed_to = ["numbers"]
 # Новые параметры
 IS_INFINITE_REMINDER = False
 # DEFAULT_REMINDER_INTERVAL = 30 * 60  # 30 минут в секундах
-MAX_REMINDERS = 3  # Максимальное количество напоминаний
+# MAX_REMINDERS = 3  # Максимальное количество напоминаний
 # DEFAULT_CHECK_INTERVAL = 5 * 60 # Проверка тикетов каждые 5 минут
 
-
-DEFAULT_REMINDER_INTERVAL = 5  # 30 минут в секундах
-DEFAULT_CHECK_INTERVAL = 1
+MAX_REMINDERS = 2
+DEFAULT_REMINDER_INTERVAL = 5
+DEFAULT_CHECK_INTERVAL = 7
 
 tickets_nt = {}
 
@@ -42,7 +42,9 @@ def send_reminder_notification(ticket):
     print(f"Отправлено напоминание пользователю {user} о тикете {ticket.id}")
 
 def send_wontfix_notification(ticket):
-    jsreq.requestPatchTicketUser(token, config.API_URL+f"tickets/api/tickets/{ticket.id}", 149)
+    response = jsreq.requestPatchTicketUser(token, config.API_URL+f"tickets/api/ticket/{ticket.id}/status", { "status": 149 })
+
+    print(response)
 
     user = "TEST_USER"
 
@@ -56,7 +58,6 @@ def send_wontfix_notification(ticket):
 
 def ticket_worker(ticket, start_time):
     if ticket.status == 131:
-        print(tickets_nt)
         if ticket.id not in tickets_nt:
             tickets_nt[ticket.id] = {
                 "reminders": 0,
@@ -74,6 +75,7 @@ def ticket_worker(ticket, start_time):
             else:
                 del tickets_nt[ticket.id]
                 send_wontfix_notification(ticket)
+        # print(tickets_nt)
 
 def ticket_list_worker(ticket_list, start_time):
     tickets=jsreq.requestGetTicket_user(token, config.API_URL+f"tickets/api/ticket_list/{ticket_list.id}")
@@ -81,7 +83,7 @@ def ticket_list_worker(ticket_list, start_time):
         ticket_worker(ticket, start_time)
 
 def status_changer():
-    x = 0
+    # x = 0
     while True:
         ticket_lists = jsreq.requestGetList(token, config.API_URL + "tickets/api/ticket_list/")
         for ticket_list in ticket_lists:
@@ -91,8 +93,8 @@ def status_changer():
             t1.start()
             t1.join()  # Ожидаем завершения обработки тикета
         time.sleep(DEFAULT_CHECK_INTERVAL)
-        print(f"|||| Интевал {x} ||||")
-        x += 1
+        # print(f"|||| Интевал {x} ||||")
+        # x += 1
 
 # Инициализация и запуск бота
 token = jsreq.requestGetToken(config.API_URL + "api/v1/auth/token/login/")