ositah 24.9.dev3__py3-none-any.whl → 24.9.dev4__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.
@@ -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(
@@ -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
@@ -99,11 +99,19 @@ declaration:
99
99
  - Administration
100
100
  - Support
101
101
  # Thresholds used to mark declarations as low, suspect or good
102
- # The value is the upper bound for the corresonding class
102
+ # The value is the upper bound for the corresponding class
103
+ # Thresholds are declared by semester as they are typically different
103
104
  thresholds:
104
- low: 50
105
- suspect: 80
106
- good: 100
105
+ # S1: assume ho holidays as the default
106
+ s1:
107
+ low: 50
108
+ suspect: 80
109
+ good: 100
110
+ # S2: assume 4 weeks of holidays by default (summer + Christmas)
111
+ s2:
112
+ low: 50
113
+ suspect: 70
114
+ good: 85
107
115
 
108
116
  # Information related to declaration analysis
109
117
  analysis:
ositah/utils/utils.py CHANGED
@@ -381,12 +381,17 @@ 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
- if "thresholds" in config["declaration"]:
384
+ missing_params = []
385
+ for semester in ["s1", "s2"]:
385
386
  for k in ["low", "suspect", "good"]:
386
- if k not in config["declaration"]["thresholds"]:
387
- raise ConfigMissingParam(f"declaration/thresholds/{k}", file)
388
- else:
389
- config["declaration"]["thresholds"] = {"low": 50, "suspect": 75, "good": 100}
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
397
  config["declaration"]["default_date"] = datetime.now()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ositah
3
- Version: 24.9.dev3
3
+ Version: 24.9.dev4
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=uLJAcPNziiOBFqjnUGLs7fPEhntpRJ3Pzu5Ab4CSxXQ,7571
4
+ ositah/ositah.example.cfg,sha256=XiMfDdolCxqnN0U6sF06a5IPATLRg-vhA9EKazYEvJA,7834
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=avzGAX2qRiuLCg0BLLt0a4cf6ZRD1bNBp5cHQVrShNI,24372
18
- ositah/apps/validation/tools.py,sha256=jyKQtVMylYkurVLTmRLtuICpjwN5LM4YMB4PPS4GMaA,18105
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
@@ -37,10 +37,10 @@ ositah/utils/menus.py,sha256=Xoyo2ySX0MD7phzyO5WjEcR0PCXwsX1TSrzONXnX4yI,12005
37
37
  ositah/utils/period.py,sha256=CxT77mAQasD59BmecXRUwme-_76hOr2kotOwTy6ZKfk,4058
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=N7Ze4PshzRi8v204mRdDJ6QSmUZvckqH3oHKkI7WaWI,16667
41
- ositah-24.9.dev3.dist-info/LICENSE,sha256=2C86YWCx1fvz92WySupcb6_t4NhHCVPE_ucy0YMTuoc,1550
42
- ositah-24.9.dev3.dist-info/METADATA,sha256=jibVKLeSDzkEn_7pljac1KFSwTmoAPDHLUHk9EMGVR8,8104
43
- ositah-24.9.dev3.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
44
- ositah-24.9.dev3.dist-info/entry_points.txt,sha256=t9oDDLUO1LwHJewlE862LbJMHpDTEyqbeUAPw_F7Q3I,44
45
- ositah-24.9.dev3.dist-info/top_level.txt,sha256=3kfj_oK4xoZFt0nsw6KKT_aoqshELBu0ryLXECbcqNI,7
46
- ositah-24.9.dev3.dist-info/RECORD,,
40
+ ositah/utils/utils.py,sha256=BYBXJx4TM4pSyKx8WM-C_qSWK0RTIyDaQ4Yz0nzWxag,16862
41
+ ositah-24.9.dev4.dist-info/LICENSE,sha256=2C86YWCx1fvz92WySupcb6_t4NhHCVPE_ucy0YMTuoc,1550
42
+ ositah-24.9.dev4.dist-info/METADATA,sha256=dpGdec8JsIY0LRWit-M-6StFie3jfcOLCSoMkXr6ADI,8106
43
+ ositah-24.9.dev4.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
44
+ ositah-24.9.dev4.dist-info/entry_points.txt,sha256=t9oDDLUO1LwHJewlE862LbJMHpDTEyqbeUAPw_F7Q3I,44
45
+ ositah-24.9.dev4.dist-info/top_level.txt,sha256=3kfj_oK4xoZFt0nsw6KKT_aoqshELBu0ryLXECbcqNI,7
46
+ ositah-24.9.dev4.dist-info/RECORD,,