12-hour working day
This commit is contained in:
parent
dd08821aea
commit
60e1da2825
@ -135,7 +135,6 @@ ACCOUNT_ACTIVATION_DAYS = 7
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGOUT_REDIRECT_URL = '/'
|
||||
|
||||
|
||||
# Название_приложения.Название_файла.Название_класса_обработчика
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
'access_controller.auth.EmailAuthBackend',
|
||||
@ -183,3 +182,5 @@ ZENDESK_ROLES = {
|
||||
'engineer': 360005209000,
|
||||
'light_agent': 360005208980,
|
||||
}
|
||||
|
||||
ONE_DAY = 12 # Количество часов в 1 рабочем дне
|
||||
|
@ -33,8 +33,6 @@ urlpatterns = [
|
||||
path('work/<int:id>', work_page, name="work"),
|
||||
path('work/hand_over/', work_hand_over, name="work_hand_over"),
|
||||
path('work/become_engineer/', work_become_engineer, name="work_become_engineer"),
|
||||
path('accounts/', include('django_registration.backends.activation.urls')),
|
||||
path('accounts/login/', include('django.contrib.auth.urls')),
|
||||
path('control/', AdminPageView.as_view(), name='control'),
|
||||
path('statistic/', statistic_page, name='statistic')
|
||||
]
|
||||
|
@ -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):
|
||||
|
@ -10,5 +10,5 @@
|
||||
|
||||
{% block content %}
|
||||
<br>
|
||||
<h4> Регистрация прошла успешно. <a href="/login/">Войти сейчас</a></h4>
|
||||
<h4> Регистрация прошла успешно. <a href="{% url 'login'%}">Войти сейчас</a></h4>
|
||||
{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user