Fix
This commit is contained in:
parent
0dc840bba7
commit
5ea0aa9454
@ -181,5 +181,3 @@ ACTRL_ZENDESK_SUBDOMAIN = os.getenv('ACTRL_ZENDESK_SUBDOMAIN') or os.getenv('ZD_
|
||||
ACTRL_API_EMAIL = os.getenv('ACTRL_API_EMAIL') or os.getenv('ACCESS_CONTROLLER_API_EMAIL')
|
||||
ACTRL_API_TOKEN = os.getenv('ACTRL_API_TOKEN') or os.getenv('ACCESS_CONTROLLER_API_TOKEN')
|
||||
ACTRL_API_PASSWORD = os.getenv('ACTRL_API_PASSWORD') or os.getenv('ACCESS_CONTROLLER_API_PASSWORD')
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ import logging
|
||||
from datetime import timedelta, datetime, date
|
||||
from typing import Optional, Union
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect
|
||||
@ -34,7 +34,6 @@ def update_role(user_profile: UserProfile, role: int, who_changes: get_user_mode
|
||||
user.custom_role_id = role
|
||||
user_profile.custom_role_id = role
|
||||
user_profile.save()
|
||||
log(user_profile, who_changes.userprofile)
|
||||
zendesk.admin.users.update(user)
|
||||
|
||||
|
||||
@ -54,7 +53,8 @@ def make_light_agent(user_profile: UserProfile, who_changes: get_user_model()) -
|
||||
Функция устанавливает пользователю роль легкого агента.
|
||||
|
||||
:param user_profile: Профиль пользователя
|
||||
:return: Вызов функции **update_role** с параметрами: профиль пользователя, роль "light_agent"
|
||||
:return: Вызов функции **update_role** с параметрами:
|
||||
профиль пользователя, роль "light_agent"
|
||||
"""
|
||||
tickets: SearchResultGenerator = get_tickets_list(user_profile.user.email)
|
||||
ticket: ZenpyTicket
|
||||
@ -62,7 +62,8 @@ def make_light_agent(user_profile: UserProfile, who_changes: get_user_model()) -
|
||||
UnassignedTicket.objects.create(
|
||||
assignee=user_profile.user,
|
||||
ticket_id=ticket.id,
|
||||
status=UnassignedTicketStatus.SOLVED if ticket.status == 'solved' else UnassignedTicketStatus.UNASSIGNED
|
||||
status=UnassignedTicketStatus.SOLVED if ticket.status == 'solved'
|
||||
else UnassignedTicketStatus.UNASSIGNED
|
||||
)
|
||||
if ticket.status == 'solved':
|
||||
ticket.assignee_id = zenpy.solved_tickets_user_id
|
||||
@ -285,8 +286,9 @@ class StatisticData:
|
||||
"""
|
||||
Функция возвращает статистику работы пользователя.
|
||||
|
||||
:return: Словарь statistic с применением формата отображения и интервала работы(если они есть). None, если были
|
||||
ошибки при создании.
|
||||
:return: Словарь statistic с применением формата отображения
|
||||
и интервала работы(если они есть).
|
||||
None, если были ошибки при создании.
|
||||
"""
|
||||
if self.is_valid_statistic():
|
||||
stat = self.statistic
|
||||
@ -375,9 +377,12 @@ class StatisticData:
|
||||
if self.interval == 'months':
|
||||
# Переделываем ключи под формат('начало_месяца - конец_месяца')
|
||||
for key, value in stat.items():
|
||||
current_month_start = max(self.start_date, date(year=key.year, month=key.month, day=1))
|
||||
current_month_end = min(self.end_date, last_day_of_month(date(year=key.year, month=key.month, day=1)))
|
||||
index = ' - '.join([str(current_month_start), str(current_month_end)])
|
||||
current_month_start = max(self.start_date, date(
|
||||
year=key.year, month=key.month, day=1))
|
||||
current_month_end = min(self.end_date, last_day_of_month(
|
||||
date(year=key.year, month=key.month, day=1)))
|
||||
index = ' - '.join([str(current_month_start),
|
||||
str(current_month_end)])
|
||||
if new_stat.get(index):
|
||||
new_stat[index] += value
|
||||
else:
|
||||
|
@ -307,7 +307,6 @@ class AdminPageView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageM
|
||||
self.make_light_agents(users)
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
def make_engineers(self, users: list) -> None:
|
||||
"""
|
||||
Функция проходит по списку пользователей, проставляя статус "engineer".
|
||||
|
Loading…
x
Reference in New Issue
Block a user