12-hour working day

This commit is contained in:
Sokurov Idar
2021-03-11 19:17:11 +03:00
parent dd08821aea
commit 60e1da2825
4 changed files with 7 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ from django.contrib.auth.models import User
from zenpy import Zenpy
from zenpy.lib.exception import APIException
from access_controller.settings import ZENDESK_ROLES as ROLES
from access_controller.settings import ZENDESK_ROLES as ROLES, ONE_DAY
from main.models import UserProfile, RoleChangeLogs
@@ -73,7 +73,7 @@ class ZendeskAdmin:
user = self.admin.users.search(email).values[0]
return user.photo['content_url'] if user.photo else None
def get_user(self, email: str) -> str:
def get_user(self, email: str):
"""
Функция **get_user** возвращает пользователя (объект) по его email
@@ -156,7 +156,7 @@ def update_profile(user_profile: UserProfile) -> UserProfile:
"""
user = ZendeskAdmin().get_user(user_profile.user.email)
user_profile.name = user.name
user_profile.role = user.role
user_profile.role = user.custom_role_id if user.custom_role_id else 0
user_profile.image = user.photo['content_url'] if user.photo else None
user_profile.save()
@@ -288,7 +288,7 @@ class StatisticData:
if self.display == 'hours':
new_stat[key] = item / 3600
elif self.display == 'days':
new_stat[key] = item / 86400
new_stat[key] = item / (ONE_DAY * 3600)
return new_stat
def _use_interval(self, stat):

View File

@@ -10,5 +10,5 @@
{% block content %}
<br>
<h4> Регистрация прошла успешно. <a href="/login/">Войти сейчас</a></h4>
<h4> Регистрация прошла успешно. <a href="{% url 'login'%}">Войти сейчас</a></h4>
{% endblock %}