ositah 24.9.dev3__py3-none-any.whl → 24.9.dev5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ositah might be problematic. Click here for more details.
- ositah/apps/validation/tables.py +2 -0
- ositah/apps/validation/tools.py +21 -2
- ositah/ositah.example.cfg +15 -5
- ositah/utils/period.py +6 -2
- ositah/utils/utils.py +16 -7
- {ositah-24.9.dev3.dist-info → ositah-24.9.dev5.dist-info}/METADATA +2 -2
- {ositah-24.9.dev3.dist-info → ositah-24.9.dev5.dist-info}/RECORD +11 -11
- {ositah-24.9.dev3.dist-info → ositah-24.9.dev5.dist-info}/LICENSE +0 -0
- {ositah-24.9.dev3.dist-info → ositah-24.9.dev5.dist-info}/WHEEL +0 -0
- {ositah-24.9.dev3.dist-info → ositah-24.9.dev5.dist-info}/entry_points.txt +0 -0
- {ositah-24.9.dev3.dist-info → ositah-24.9.dev5.dist-info}/top_level.txt +0 -0
ositah/apps/validation/tables.py
CHANGED
|
@@ -23,6 +23,7 @@ from ositah.apps.validation.tools import (
|
|
|
23
23
|
agent_project_time,
|
|
24
24
|
agent_tooltip_txt,
|
|
25
25
|
category_declarations,
|
|
26
|
+
define_declaration_thresholds,
|
|
26
27
|
get_all_validation_status,
|
|
27
28
|
validation_started,
|
|
28
29
|
)
|
|
@@ -71,6 +72,7 @@ def build_validation_table(team, team_selection_date, declaration_set: int, peri
|
|
|
71
72
|
validation_disabled = not validation_started(period_date)
|
|
72
73
|
|
|
73
74
|
validation_data = get_all_validation_status(period_date)
|
|
75
|
+
define_declaration_thresholds(period_date)
|
|
74
76
|
|
|
75
77
|
try:
|
|
76
78
|
project_declarations = get_team_projects(
|
ositah/apps/validation/tools.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Various functions used by Validation sub-application
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from datetime import datetime
|
|
5
|
+
from datetime import date, datetime
|
|
6
6
|
|
|
7
7
|
import dash_bootstrap_components as dbc
|
|
8
8
|
import pandas as pd
|
|
@@ -54,7 +54,7 @@ def activity_time_cell(row, column, row_index):
|
|
|
54
54
|
cell_id = f"validation-table-value-{row_index}-{column}"
|
|
55
55
|
|
|
56
56
|
if column == "percent_global":
|
|
57
|
-
thresholds = global_params.declaration_options["thresholds"]
|
|
57
|
+
thresholds = global_params.declaration_options["thresholds"]["current"]
|
|
58
58
|
percent = round(row["percent_global"], 1)
|
|
59
59
|
if percent <= thresholds["low"]:
|
|
60
60
|
percent_class = "table-danger"
|
|
@@ -374,6 +374,25 @@ def category_declarations(
|
|
|
374
374
|
return category_declarations
|
|
375
375
|
|
|
376
376
|
|
|
377
|
+
def define_declaration_thresholds(period_date: str):
|
|
378
|
+
"""
|
|
379
|
+
Define the declaration thresholds (low, suspect, normal) for the current period
|
|
380
|
+
|
|
381
|
+
:param period_date: a date that must be inside the declaration period
|
|
382
|
+
"""
|
|
383
|
+
global_params = GlobalParams()
|
|
384
|
+
|
|
385
|
+
period_datetime = date.fromisoformat(period_date)
|
|
386
|
+
if period_datetime.month >= 7:
|
|
387
|
+
global_params.declaration_options["thresholds"]["current"] = (
|
|
388
|
+
global_params.declaration_options["thresholds"]["s2"]
|
|
389
|
+
)
|
|
390
|
+
else:
|
|
391
|
+
global_params.declaration_options["thresholds"]["current"] = (
|
|
392
|
+
global_params.declaration_options["thresholds"]["s1"]
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
|
|
377
396
|
def get_validation_data(agent_id, period_date: str, session=None):
|
|
378
397
|
"""
|
|
379
398
|
Return the validation data for an agent or None if there is no entry in the database for this
|
ositah/ositah.example.cfg
CHANGED
|
@@ -84,8 +84,10 @@ server:
|
|
|
84
84
|
|
|
85
85
|
# Options related to declarations
|
|
86
86
|
declaration:
|
|
87
|
-
# Default date must be a date included into the selected validation period. It is a default, if no other explicitly
|
|
87
|
+
# Default date must be a date included into the selected validation period. It is a default, if no other explicitly selection
|
|
88
88
|
#default_date: 2021-07-01
|
|
89
|
+
# Delay (in days) before setting the default period to the next one, after the end of the period. Ignored if default_date is defined
|
|
90
|
+
period_change_delay: 60
|
|
89
91
|
# max_hours specifies the upper valid value for activities declared in hours
|
|
90
92
|
max_hours: 400
|
|
91
93
|
# Agent statut whose declaration is not mandatory
|
|
@@ -99,11 +101,19 @@ declaration:
|
|
|
99
101
|
- Administration
|
|
100
102
|
- Support
|
|
101
103
|
# Thresholds used to mark declarations as low, suspect or good
|
|
102
|
-
# The value is the upper bound for the
|
|
104
|
+
# The value is the upper bound for the corresponding class
|
|
105
|
+
# Thresholds are declared by semester as they are typically different
|
|
103
106
|
thresholds:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
# S1: assume ho holidays as the default
|
|
108
|
+
s1:
|
|
109
|
+
low: 50
|
|
110
|
+
suspect: 80
|
|
111
|
+
good: 100
|
|
112
|
+
# S2: assume 4 weeks of holidays by default (summer + Christmas)
|
|
113
|
+
s2:
|
|
114
|
+
low: 50
|
|
115
|
+
suspect: 70
|
|
116
|
+
good: 85
|
|
107
117
|
|
|
108
118
|
# Information related to declaration analysis
|
|
109
119
|
analysis:
|
ositah/utils/period.py
CHANGED
|
@@ -119,7 +119,8 @@ def get_declaration_periods(descending: bool = True) -> List[OSITAHDeclarationPe
|
|
|
119
119
|
def get_default_period_date(periods: List[OSITAHDeclarationPeriod], date: datetime.date):
|
|
120
120
|
"""
|
|
121
121
|
Return the start date of the default period. The default period is selected by passing a date
|
|
122
|
-
that must be between period start and end dates (included).
|
|
122
|
+
that must be between period start and end dates (included). If none matches, select the last
|
|
123
|
+
period.
|
|
123
124
|
|
|
124
125
|
:param periods: period list
|
|
125
126
|
:param date: date that must be inside the period (string)
|
|
@@ -127,9 +128,12 @@ def get_default_period_date(periods: List[OSITAHDeclarationPeriod], date: dateti
|
|
|
127
128
|
"""
|
|
128
129
|
|
|
129
130
|
period_date = date.isoformat()
|
|
131
|
+
last_start_date = None
|
|
130
132
|
|
|
131
133
|
for p in periods:
|
|
132
134
|
if period_date >= p.start_date and period_date <= p.end_date:
|
|
133
135
|
return p.start_date
|
|
136
|
+
if last_start_date is None or p.start_date > last_start_date:
|
|
137
|
+
last_start_date = p.start_date
|
|
134
138
|
|
|
135
|
-
return
|
|
139
|
+
return last_start_date
|
ositah/utils/utils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Convenience objects for OSITAH application
|
|
2
2
|
|
|
3
|
-
from datetime import datetime
|
|
3
|
+
from datetime import datetime, timedelta
|
|
4
4
|
from typing import List
|
|
5
5
|
|
|
6
6
|
import dash_bootstrap_components as dbc
|
|
@@ -381,15 +381,24 @@ def define_config_params(file):
|
|
|
381
381
|
if "max_hours" not in config["declaration"]:
|
|
382
382
|
# Set a very high value
|
|
383
383
|
config["declaration"]["max_hours"] = 99999
|
|
384
|
-
|
|
384
|
+
missing_params = []
|
|
385
|
+
for semester in ["s1", "s2"]:
|
|
385
386
|
for k in ["low", "suspect", "good"]:
|
|
386
|
-
if
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
387
|
+
if (
|
|
388
|
+
"thresholds" not in config["declaration"]
|
|
389
|
+
or semester not in config["declaration"]["thresholds"]
|
|
390
|
+
or k not in config["declaration"]["thresholds"][semester]
|
|
391
|
+
):
|
|
392
|
+
missing_params.append(f"declaration/thresholds/{semester}/{k}")
|
|
393
|
+
if len(missing_params) > 0:
|
|
394
|
+
raise ConfigMissingParam(", ".join(missing_params), file)
|
|
390
395
|
# Default declaration period date defaults to current day if not explicitly defined
|
|
391
396
|
if "default_date" not in config["declaration"]:
|
|
392
|
-
config["declaration"]
|
|
397
|
+
if "period_change_delay" in config["declaration"]:
|
|
398
|
+
change_delay = config["declaration"]["period_change_delay"]
|
|
399
|
+
else:
|
|
400
|
+
change_delay = 0
|
|
401
|
+
config["declaration"]["default_date"] = datetime.now() - timedelta(days=change_delay)
|
|
393
402
|
global_params.declaration_options = config["declaration"]
|
|
394
403
|
|
|
395
404
|
if "analysis" not in config:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ositah
|
|
3
|
-
Version: 24.9.
|
|
3
|
+
Version: 24.9.dev5
|
|
4
4
|
Summary: Outils de Suivi d'Activités basé sur Hito
|
|
5
5
|
Author-email: Michel Jouvin <michel.jouvin@ijclab.in2p3.fr>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -19,7 +19,7 @@ Requires-Dist: flask
|
|
|
19
19
|
Requires-Dist: flask-multipass
|
|
20
20
|
Requires-Dist: flask-sqlalchemy ~=3.0
|
|
21
21
|
Requires-Dist: flask-wtf
|
|
22
|
-
Requires-Dist: hito-tools >=24.8
|
|
22
|
+
Requires-Dist: hito-tools >=24.8.1
|
|
23
23
|
Requires-Dist: pandas >=2.2
|
|
24
24
|
Requires-Dist: pymysql
|
|
25
25
|
Requires-Dist: python-ldap
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
ositah/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
ositah/app.py,sha256=53ylXmqBSo31omZt-XBPBhOzlkGQBuDenU0Q8m7efCg,428
|
|
3
3
|
ositah/main.py,sha256=vw8PBYP3ugtWKWUta3UKagh8lbp-ogl8LUNF-KSyo0s,15673
|
|
4
|
-
ositah/ositah.example.cfg,sha256=
|
|
4
|
+
ositah/ositah.example.cfg,sha256=4zQOL3ynGN9bO6j-bekJeJWUe7Xq-c0eySNOHKMr2K8,8000
|
|
5
5
|
ositah/apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
ositah/apps/analysis.py,sha256=9EDXcCtXtAiCdyG8kZXJDAQXLuTG7gTZbsnKnL_ehiw,28635
|
|
7
7
|
ositah/apps/export.py,sha256=4h9_nk9uKopwfxgzqKyFk5u4qVQ9mtgGvk3zmxbhTV0,47532
|
|
@@ -14,8 +14,8 @@ ositah/apps/validation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
14
14
|
ositah/apps/validation/callbacks.py,sha256=N9j0HLe8Xp1zZUrVgx0woeDBwVtJLQZ_BPVNaJ9UIZo,9557
|
|
15
15
|
ositah/apps/validation/main.py,sha256=en9D6c65DUosbU31dxLR6BhLCU3yj7uxyoS3MYzvw30,2896
|
|
16
16
|
ositah/apps/validation/parameters.py,sha256=tDHqDnoWv1QhcTad2yhqLT9_wCpj8sTYxKWsi1UF-uk,1003
|
|
17
|
-
ositah/apps/validation/tables.py,sha256=
|
|
18
|
-
ositah/apps/validation/tools.py,sha256=
|
|
17
|
+
ositah/apps/validation/tables.py,sha256=eJ8dhYukhT1y_y8W8fjFv5Wek3knmGxAcQFFV708llM,24456
|
|
18
|
+
ositah/apps/validation/tools.py,sha256=5c4IbAB_8KCgl44gNI0Qe0f3hRwJ6GAVRyIFKJ7iNhc,18800
|
|
19
19
|
ositah/assets/arrow_down_up.svg,sha256=jH7QOmbLkYnNENa2PlBktOYHKDGN5KbrrFcV6UpgkCY,503
|
|
20
20
|
ositah/assets/ositah.css,sha256=_T3mwonAYMPoDJoHYgJ5XgdFllHMcE28vnMMDd_hdOQ,1094
|
|
21
21
|
ositah/assets/sort_ascending.svg,sha256=Rg4wPgEBEBU9hDPgNnenFYkFLC18qKw0flaBk_8Y-uM,593
|
|
@@ -34,13 +34,13 @@ ositah/utils/exceptions.py,sha256=ZVngkr28pBxO-kZAeKW9FWAFyhzuWL98-S92mieHMSk,19
|
|
|
34
34
|
ositah/utils/hito_db.py,sha256=awVGrd1DAyj6BaEkLjTVN1l9A5SjZUJ1-fQ5PAik7bI,1510
|
|
35
35
|
ositah/utils/hito_db_model.py,sha256=GvCHp5u-mPQinbZPvF6ONJAWIc2no1KN_VNJv6NCaPk,9356
|
|
36
36
|
ositah/utils/menus.py,sha256=Xoyo2ySX0MD7phzyO5WjEcR0PCXwsX1TSrzONXnX4yI,12005
|
|
37
|
-
ositah/utils/period.py,sha256=
|
|
37
|
+
ositah/utils/period.py,sha256=ZuaiZ2gvSIjd23isvygEVoAvonH4ehbexjrS4EwSGyI,4258
|
|
38
38
|
ositah/utils/projects.py,sha256=LuyUVtKqTb3qUWbsgwrE-9DqyW1bkV9y-n_n0oRaotQ,43476
|
|
39
39
|
ositah/utils/teams.py,sha256=K8Z6kqs-kFpNiIg6wgmmZ3_tmfUPaB7wp0OAGmmZPG4,1234
|
|
40
|
-
ositah/utils/utils.py,sha256=
|
|
41
|
-
ositah-24.9.
|
|
42
|
-
ositah-24.9.
|
|
43
|
-
ositah-24.9.
|
|
44
|
-
ositah-24.9.
|
|
45
|
-
ositah-24.9.
|
|
46
|
-
ositah-24.9.
|
|
40
|
+
ositah/utils/utils.py,sha256=NQq0roHDvIkKj1gl88yu3bvloH0dPnBE1rKXVP_hdK4,17082
|
|
41
|
+
ositah-24.9.dev5.dist-info/LICENSE,sha256=2C86YWCx1fvz92WySupcb6_t4NhHCVPE_ucy0YMTuoc,1550
|
|
42
|
+
ositah-24.9.dev5.dist-info/METADATA,sha256=sOyz93EedQL_ZsXMyavpBtsCpqoaZaBnp0HmTZHl7Rg,8106
|
|
43
|
+
ositah-24.9.dev5.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
|
44
|
+
ositah-24.9.dev5.dist-info/entry_points.txt,sha256=t9oDDLUO1LwHJewlE862LbJMHpDTEyqbeUAPw_F7Q3I,44
|
|
45
|
+
ositah-24.9.dev5.dist-info/top_level.txt,sha256=3kfj_oK4xoZFt0nsw6KKT_aoqshELBu0ryLXECbcqNI,7
|
|
46
|
+
ositah-24.9.dev5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|