From d34adf3dd3abe6157a265f2279422b6b79912b5f Mon Sep 17 00:00:00 2001 From: hyh123a Date: Mon, 18 Apr 2022 21:45:14 +0800 Subject: [PATCH] fixed the bug --- myems-api/reports/ticket.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/myems-api/reports/ticket.py b/myems-api/reports/ticket.py index 55937474..c555c831 100644 --- a/myems-api/reports/ticket.py +++ b/myems-api/reports/ticket.py @@ -338,6 +338,20 @@ class TicketAgentListCollection: cnx = mysql.connector.connect(**config.loonflow) cursor = cnx.cursor() + # Get Ticket ids + query = (" SELECT id, ticket_id " + " FROM ticket_ticketuser " + " WHERE in_process = 1 and worked = 0 " + " ORDER BY id DESC ") + cursor.execute(query) + rows = cursor.fetchall() + + ticket_ids = [] + if rows is not None and len(rows) > 0: + for row in rows: + ticket_id = row[1] + ticket_ids.append(ticket_id) + query = (" SELECT id, name " " FROM workflow_workflow " " ORDER BY id ") @@ -372,6 +386,9 @@ class TicketAgentListCollection: result = list() if rows is not None and len(rows) > 0: for row in rows: + _id = row[0] + if _id not in ticket_ids: + continue meta_result = {"id": row[0], "title": row[1], "ticket_type": workflow_result.get(row[2]),