ositah 24.9.dev2__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.
ositah/apps/analysis.py CHANGED
@@ -301,11 +301,22 @@ def project_agents_time(declarations, project):
301
301
  global_params = GlobalParams()
302
302
  columns = global_params.columns
303
303
 
304
- project_agents = declarations[declarations[columns["activity"]] == project].sort_values(
305
- by="nom"
304
+ project_agents = declarations[declarations[columns["activity"]] == project]
305
+ project_agents.loc[:, columns["hours"]] = np.round(project_agents[columns["hours"]]).astype(
306
+ "int"
307
+ )
308
+ project_agents.loc[:, columns["weeks"]] = np.round(
309
+ project_agents.loc[:, columns["hours"]] / WEEK_HOURS, 1
310
+ )
311
+ if global_params.analysis_params["contributions_sorted_by_name"]:
312
+ sort_by = ["nom", columns["hours"]]
313
+ sort_ascending = True
314
+ else:
315
+ sort_by = [columns["hours"], "nom"]
316
+ sort_ascending = False
317
+ project_agents.sort_values(
318
+ by=sort_by, ascending=sort_ascending, ignore_index=True, inplace=True
306
319
  )
307
- project_agents[columns["hours"]] = np.round(project_agents[columns["hours"]]).astype("int")
308
- project_agents[columns["weeks"]] = np.round(project_agents[columns["hours"]] / WEEK_HOURS, 1)
309
320
  return html.Div(
310
321
  [
311
322
  html.Div(
@@ -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,23 @@ 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
115
+
116
+ # Information related to declaration analysis
117
+ analysis:
118
+ contributions_sorted_by_name: False
107
119
 
108
120
  # Information related to validation
109
121
  validation:
ositah/utils/utils.py CHANGED
@@ -224,6 +224,7 @@ class OSITAHSessionData:
224
224
  class GlobalParams:
225
225
  def __init__(self):
226
226
  self.agent_query = None
227
+ self.analysis_params = None
227
228
  self.category_patterns = {}
228
229
  self.columns = COLUMN_NAMES
229
230
  self.column_titles = None
@@ -380,17 +381,28 @@ def define_config_params(file):
380
381
  if "max_hours" not in config["declaration"]:
381
382
  # Set a very high value
382
383
  config["declaration"]["max_hours"] = 99999
383
- if "thresholds" in config["declaration"]:
384
+ missing_params = []
385
+ for semester in ["s1", "s2"]:
384
386
  for k in ["low", "suspect", "good"]:
385
- if k not in config["declaration"]["thresholds"]:
386
- raise ConfigMissingParam(f"declaration/thresholds/{k}", file)
387
- else:
388
- 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)
389
395
  # Default declaration period date defaults to current day if not explicitly defined
390
396
  if "default_date" not in config["declaration"]:
391
397
  config["declaration"]["default_date"] = datetime.now()
392
398
  global_params.declaration_options = config["declaration"]
393
399
 
400
+ if "analysis" not in config:
401
+ config["analysis"] = {}
402
+ if "contributions_sorted_by_name" not in config["analysis"]:
403
+ config["analysis"]["contributions_sorted_by_name"] = True
404
+ global_params.analysis_params = config["analysis"]
405
+
394
406
  if "validation" not in config:
395
407
  config["validation"] = {}
396
408
  if "override_period" not in config["validation"]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ositah
3
- Version: 24.9.dev2
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,9 +1,9 @@
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=-k6Bytmuml3KHQn_1gGxW2k2bBAc39zPN6Ew5rG14xw,7472
4
+ ositah/ositah.example.cfg,sha256=XiMfDdolCxqnN0U6sF06a5IPATLRg-vhA9EKazYEvJA,7834
5
5
  ositah/apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- ositah/apps/analysis.py,sha256=lGcXTOCZuP9mIYpZA3zgKdAPk_s0pvfso2u_Qux0DRo,28266
6
+ ositah/apps/analysis.py,sha256=9EDXcCtXtAiCdyG8kZXJDAQXLuTG7gTZbsnKnL_ehiw,28635
7
7
  ositah/apps/export.py,sha256=4h9_nk9uKopwfxgzqKyFk5u4qVQ9mtgGvk3zmxbhTV0,47532
8
8
  ositah/apps/configuration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  ositah/apps/configuration/callbacks.py,sha256=J1bWwxQF2JRX6vvkTF22XXr4R2HEEXyK3ht75hbFgAM,33477
@@ -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=rUp366CNWLX3GMMHcJsau_y6kp52uCs1Hels2ESatGY,16372
41
- ositah-24.9.dev2.dist-info/LICENSE,sha256=2C86YWCx1fvz92WySupcb6_t4NhHCVPE_ucy0YMTuoc,1550
42
- ositah-24.9.dev2.dist-info/METADATA,sha256=ryiLBIDLx3lxFT0_dH30Gu2Y3nd88C6wtIorHmaeri0,8104
43
- ositah-24.9.dev2.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
44
- ositah-24.9.dev2.dist-info/entry_points.txt,sha256=t9oDDLUO1LwHJewlE862LbJMHpDTEyqbeUAPw_F7Q3I,44
45
- ositah-24.9.dev2.dist-info/top_level.txt,sha256=3kfj_oK4xoZFt0nsw6KKT_aoqshELBu0ryLXECbcqNI,7
46
- ositah-24.9.dev2.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,,