Fix make_light_agent method while tickets.count is 0.
This commit is contained in:
parent
96e5865d3b
commit
73e9c9fd34
@ -9,6 +9,7 @@ from django.utils import timezone
|
||||
from zenpy import Zenpy
|
||||
from zenpy.lib.exception import APIException
|
||||
from zenpy.lib.api_objects import User as ZenpyUser, Ticket as ZenpyTicket
|
||||
from zenpy.lib.generator import SearchResultGenerator
|
||||
|
||||
from access_controller.settings import ZENDESK_ROLES as ROLES, ONE_DAY, ACTRL_ZENDESK_SUBDOMAIN
|
||||
from main.models import UserProfile, RoleChangeLogs, UnassignedTicket, UnassignedTicketStatus
|
||||
@ -48,7 +49,7 @@ def make_light_agent(user_profile: UserProfile, who_changes: User) -> None:
|
||||
:param user_profile: Профиль пользователя
|
||||
:return: Вызов функции **update_role** с параметрами: профиль пользователя, роль "light_agent"
|
||||
"""
|
||||
tickets = get_tickets_list(user_profile.user.email)
|
||||
tickets: SearchResultGenerator = get_tickets_list(user_profile.user.email)
|
||||
ticket: ZenpyTicket
|
||||
for ticket in tickets:
|
||||
UnassignedTicket.objects.create(
|
||||
@ -62,7 +63,8 @@ def make_light_agent(user_profile: UserProfile, who_changes: User) -> None:
|
||||
ticket.assignee = None
|
||||
ticket.group_id = zenpy.buffer_group_id
|
||||
|
||||
zenpy.admin.tickets.update(tickets.values)
|
||||
if tickets.count:
|
||||
zenpy.admin.tickets.update(tickets.values)
|
||||
|
||||
attempts, success = 5, False
|
||||
while not success and attempts != 0:
|
||||
|
@ -1,6 +1,4 @@
|
||||
"use strict";
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
|
||||
function head_checkbox() {
|
||||
let head_checkbox = document.getElementById("head-checkbox");
|
||||
|
Loading…
x
Reference in New Issue
Block a user