|
@@ -46,34 +46,37 @@ def send_wontfix_notification(user, ticket):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-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 not in tickets:
|
|
|
|
- tickets_nt[ticket.id] = {
|
|
|
|
- "reminders": 0,
|
|
|
|
- "last_date_reminder": start_time
|
|
|
|
- }
|
|
|
|
|
|
+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
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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_nt[ticket.id]
|
|
|
|
+ # Функция смены статуса на WONTFIX
|
|
|
|
|
|
- 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_nt[ticket.id]
|
|
|
|
- # Функция смены статуса на WONTFIX
|
|
|
|
-
|
|
|
|
- tickets_nt[ticket.id]["reminders"] += 1
|
|
|
|
- tickets_nt[ticket.id]["last_date_reminder"] += start_time
|
|
|
|
|
|
+ tickets_nt[ticket.id]["reminders"] += 1
|
|
|
|
+ tickets_nt[ticket.id]["last_date_reminder"] += start_time
|
|
|
|
+
|
|
|
|
|
|
|
|
+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)
|
|
|
|
|
|
def status_changer():
|
|
def status_changer():
|
|
while True:
|
|
while True:
|
|
- ticketlists = jsreq.requestGetList(token, config.API_URL + "tickets/api/ticket_list/")
|
|
|
|
- for ticketlist in ticketlists:
|
|
|
|
|
|
+ ticket_lists = jsreq.requestGetList(token, config.API_URL + "tickets/api/ticket_list/")
|
|
|
|
+ for ticket_list in ticket_lists:
|
|
start_time = datetime.now()
|
|
start_time = datetime.now()
|
|
# bot.bot_log(f"{botname} {start_time.strftime('%Y-%m-%d')} Тикет {ticketlist.id} в обработке\n")
|
|
# bot.bot_log(f"{botname} {start_time.strftime('%Y-%m-%d')} Тикет {ticketlist.id} в обработке\n")
|
|
- t1 = threading.Thread(target=process_in_progress_ticket, args=(ticketlist, start_time))
|
|
|
|
|
|
+ t1 = threading.Thread(target=ticket_list_worker, args=(ticket_list, start_time))
|
|
t1.start()
|
|
t1.start()
|
|
t1.join() # Ожидаем завершения обработки тикета
|
|
t1.join() # Ожидаем завершения обработки тикета
|
|
time.sleep(DEFAULT_CHECK_INTERVAL)
|
|
time.sleep(DEFAULT_CHECK_INTERVAL)
|