Merge branch 'hotfix/make_light_agent_with_zero_tickets' into 'develop'
Fix make_light_agent method while tickets.count is 0. See merge request 2020-2021/online/s101/group-02/access_controller!67
This commit is contained in:
commit
1889b6cdb7
@ -9,6 +9,7 @@ from django.utils import timezone
|
|||||||
from zenpy import Zenpy
|
from zenpy import Zenpy
|
||||||
from zenpy.lib.exception import APIException
|
from zenpy.lib.exception import APIException
|
||||||
from zenpy.lib.api_objects import User as ZenpyUser, Ticket as ZenpyTicket
|
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 access_controller.settings import ZENDESK_ROLES as ROLES, ONE_DAY, ACTRL_ZENDESK_SUBDOMAIN
|
||||||
from main.models import UserProfile, RoleChangeLogs, UnassignedTicket, UnassignedTicketStatus
|
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: Профиль пользователя
|
:param user_profile: Профиль пользователя
|
||||||
:return: Вызов функции **update_role** с параметрами: профиль пользователя, роль "light_agent"
|
:return: Вызов функции **update_role** с параметрами: профиль пользователя, роль "light_agent"
|
||||||
"""
|
"""
|
||||||
tickets = get_tickets_list(user_profile.user.email)
|
tickets: SearchResultGenerator = get_tickets_list(user_profile.user.email)
|
||||||
ticket: ZenpyTicket
|
ticket: ZenpyTicket
|
||||||
for ticket in tickets:
|
for ticket in tickets:
|
||||||
UnassignedTicket.objects.create(
|
UnassignedTicket.objects.create(
|
||||||
@ -62,7 +63,8 @@ def make_light_agent(user_profile: UserProfile, who_changes: User) -> None:
|
|||||||
ticket.assignee = None
|
ticket.assignee = None
|
||||||
ticket.group_id = zenpy.buffer_group_id
|
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
|
attempts, success = 5, False
|
||||||
while not success and attempts != 0:
|
while not success and attempts != 0:
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
import React from "react";
|
|
||||||
import ReactDOM from "react-dom";
|
|
||||||
|
|
||||||
function head_checkbox() {
|
function head_checkbox() {
|
||||||
let head_checkbox = document.getElementById("head-checkbox");
|
let head_checkbox = document.getElementById("head-checkbox");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user