ositah 24.9.dev7__py3-none-any.whl → 24.12.dev1__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/export.py CHANGED
@@ -164,8 +164,10 @@ def nsip_export_table(team, team_selection_date, period_date: str, declarations_
164
164
  )
165
165
  agent_list = get_agents(period_date, team)
166
166
  if team is None or team == TEAM_LIST_ALL_AGENTS:
167
- # If no team is selected, merge left to include declarations from agents who are no
168
- # longer active in Hito (e.g. agents who left the lab during the declaration period)
167
+ # If no team is selected, merge left to include declarations from agents whose
168
+ # email_auth don't match between Hito and NSIP. It is typically the case for agents
169
+ # who are no longer active in NSIP (e.g. agents who left the lab during the
170
+ # declaration period).
169
171
  merge_how = "left"
170
172
  else:
171
173
  merge_how = "inner"
@@ -210,7 +212,8 @@ def nsip_export_table(team, team_selection_date, period_date: str, declarations_
210
212
  # For OSITAH entries not found in NSIP, it may be that the agent left the lab during
211
213
  # the declaration period: in this case there is an entry in NSIP where the RESEDA email
212
214
  # has been replaced by a UUID allowing to update NSIP data. Check if such an entry
213
- # exists in NSIP with a matching fullname and use it if it exists
215
+ # exists in NSIP with a matching fullname and use it if it exists. It also happens if the
216
+ # agent email_auth changed during the period.
214
217
  # To make matching easier, index is temporarily set to fullname instead of an integer.
215
218
  nsip_missing_agent_names = declaration_list.loc[
216
219
  declaration_list["_merge"] == "left_only", columns["fullname"]
@@ -258,7 +261,7 @@ def nsip_export_table(team, team_selection_date, period_date: str, declarations_
258
261
  declaration_list.drop(columns="_merge", inplace=True)
259
262
 
260
263
  nsip_declarations = get_nsip_declarations(start_date, team)
261
- if nsip_declarations is None or len(nsip_declarations) == 0:
264
+ if nsip_declarations.empty:
262
265
  # nsip_missing is True if the OSITAH declaration has no matching declaration in NSIP
263
266
  declaration_list["nsip_missing"] = True
264
267
  # time_unit_mismatch is True only if there is a matching declaration in NSIP and time
@@ -279,6 +282,16 @@ def nsip_export_table(team, team_selection_date, period_date: str, declarations_
279
282
  declaration_list["nsip_reference_id"] = declaration_list["nsip_reference_id"].astype(
280
283
  int
281
284
  )
285
+ # In case nsip_declarations contains only references (no project), create the
286
+ # project.name column required later as it is used both for references and projects.
287
+ # Also copy reference.name into project.name if it is a reference.
288
+ if "project.name" not in nsip_declarations:
289
+ nsip_declarations["project.name"] = np.NaN
290
+ nsip_declarations.loc[
291
+ nsip_declarations["project.name"].isna(),
292
+ "nsip_project",
293
+ ] = nsip_declarations["reference.name"]
294
+ # Merge OSITAH declarations with those possibly present in NSIP
282
295
  declaration_list = declaration_list.merge(
283
296
  nsip_declarations,
284
297
  how="outer",
@@ -350,7 +363,7 @@ def nsip_export_table(team, team_selection_date, period_date: str, declarations_
350
363
  )
351
364
  # nsip_missing is True if the OSITAH declaration has no matching declaration in NSIP
352
365
  declaration_list["nsip_missing"] = declaration_list["_merge"] == "left_only"
353
- # ositah_missing is True if a declaratipn is found in NSIP without a matching
366
+ # ositah_missing is True if a declaration is found in NSIP without a matching
354
367
  # declaration in OSITAH
355
368
  declaration_list["ositah_missing"] = declaration_list["_merge"] == "right_only"
356
369
  for ositah_column, nsip_column in {
@@ -365,12 +378,6 @@ def nsip_export_table(team, team_selection_date, period_date: str, declarations_
365
378
  declaration_list.loc[declaration_list["ositah_missing"], ositah_column] = (
366
379
  declaration_list[nsip_column]
367
380
  )
368
- # Fix nsip_project if it was set to the project name when the activity is a reference
369
- declaration_list.loc[
370
- declaration_list["nsip_project"].isna()
371
- & (declaration_list["nsip_reference_id"] != 0),
372
- "nsip_project",
373
- ] = declaration_list["reference.name"]
374
381
  declaration_list.loc[
375
382
  declaration_list["nsip_agent_missing"].isna(), "nsip_agent_missing"
376
383
  ] = False
@@ -472,6 +479,16 @@ def nsip_export_table(team, team_selection_date, period_date: str, declarations_
472
479
  )
473
480
  ),
474
481
  ]
482
+ if team and team != TEAM_LIST_ALL_AGENTS:
483
+ page_title.append(
484
+ html.Div(
485
+ (
486
+ "Certains agents peuvent apparaitre non synchronisés s'ils ont quitté"
487
+ f" le laboratoire: utiliser '{TEAM_LIST_ALL_AGENTS}' pour vérifier"
488
+ ),
489
+ style={"fontStyle": "italic", "fontWeight": "bold"},
490
+ )
491
+ )
475
492
 
476
493
  if declarations_set == NSIP_DECLARATIONS_SELECT_ALL:
477
494
  selected_declarations = declaration_list
ositah/utils/projects.py CHANGED
@@ -734,6 +734,9 @@ def get_nsip_declarations(period_date: str, team: str):
734
734
 
735
735
  if global_params.nsip:
736
736
  declarations = pd.json_normalize(global_params.nsip.get_declarations(period_date))
737
+ if declarations.empty:
738
+ return declarations
739
+
737
740
  declarations.rename(columns={"id": "id_declaration"}, inplace=True)
738
741
  # Set NaN to 0 in reference as np.NaN is a float and prevent casting to int. As it will
739
742
  # be used in a merge better to have a 0 than a NaN.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ositah
3
- Version: 24.9.dev7
3
+ Version: 24.12.dev1
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
@@ -13,19 +13,19 @@ Requires-Python: >=3.9
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: blinker
16
- Requires-Dist: dash >=2.17
16
+ Requires-Dist: dash>=2.17
17
17
  Requires-Dist: dash-bootstrap-components
18
18
  Requires-Dist: flask
19
19
  Requires-Dist: flask-multipass
20
- Requires-Dist: flask-sqlalchemy ~=3.0
20
+ Requires-Dist: flask-sqlalchemy~=3.0
21
21
  Requires-Dist: flask-wtf
22
- Requires-Dist: hito-tools >=24.8.1
23
- Requires-Dist: pandas >=2.2
22
+ Requires-Dist: hito-tools>=24.8.1
23
+ Requires-Dist: pandas>=2.2
24
24
  Requires-Dist: pymysql
25
25
  Requires-Dist: python-ldap
26
26
  Requires-Dist: pyyaml
27
27
  Requires-Dist: simplejson
28
- Requires-Dist: sqlalchemy ~=2.0
28
+ Requires-Dist: sqlalchemy~=2.0
29
29
 
30
30
  # OSITAH : Outil de Suivi de Temps et d'Activités basé sur Hito
31
31
 
@@ -4,7 +4,7 @@ ositah/main.py,sha256=97IhSMIqIVWC6GdXWievxE-tu30-UboivbW9_NTNzww,15644
4
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=J9oE93g6wIvKh9TnT4TudmUdW75wzArx1CaB_1yuRB8,28634
7
- ositah/apps/export.py,sha256=i1SGeS_peohnoMRRDm0VmGsWWmn9ypix-qIKkZml1d0,47531
7
+ ositah/apps/export.py,sha256=KCz1b8u2IIG_LCpVXXJ9MMqIG7lHB8hrHnAY2npJ_3g,48416
8
8
  ositah/apps/configuration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  ositah/apps/configuration/callbacks.py,sha256=HbsyE0WeCTmPl14SAs-mDglvMywxA4qSeVN72jSv-bM,33455
10
10
  ositah/apps/configuration/main.py,sha256=LbyupMqFUPDJCZBuRzoGREuHNxbinj3Ooj1HTJCeYUM,20349
@@ -35,12 +35,12 @@ 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
37
  ositah/utils/period.py,sha256=ZuaiZ2gvSIjd23isvygEVoAvonH4ehbexjrS4EwSGyI,4258
38
- ositah/utils/projects.py,sha256=LuyUVtKqTb3qUWbsgwrE-9DqyW1bkV9y-n_n0oRaotQ,43476
38
+ ositah/utils/projects.py,sha256=hdbjXa0pGg1KLm---TgyxPOI0qcNaW64QBWSVbrgjeY,43543
39
39
  ositah/utils/teams.py,sha256=K8Z6kqs-kFpNiIg6wgmmZ3_tmfUPaB7wp0OAGmmZPG4,1234
40
40
  ositah/utils/utils.py,sha256=NQq0roHDvIkKj1gl88yu3bvloH0dPnBE1rKXVP_hdK4,17082
41
- ositah-24.9.dev7.dist-info/LICENSE,sha256=2C86YWCx1fvz92WySupcb6_t4NhHCVPE_ucy0YMTuoc,1550
42
- ositah-24.9.dev7.dist-info/METADATA,sha256=aO5d5QA88vIU0COaY2TN5QYDn6-Q7dnPFH-HDdsIozE,8106
43
- ositah-24.9.dev7.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
44
- ositah-24.9.dev7.dist-info/entry_points.txt,sha256=t9oDDLUO1LwHJewlE862LbJMHpDTEyqbeUAPw_F7Q3I,44
45
- ositah-24.9.dev7.dist-info/top_level.txt,sha256=3kfj_oK4xoZFt0nsw6KKT_aoqshELBu0ryLXECbcqNI,7
46
- ositah-24.9.dev7.dist-info/RECORD,,
41
+ ositah-24.12.dev1.dist-info/LICENSE,sha256=2C86YWCx1fvz92WySupcb6_t4NhHCVPE_ucy0YMTuoc,1550
42
+ ositah-24.12.dev1.dist-info/METADATA,sha256=XvSHRKs4jevkgYMdlYpqh9xTRidxZ74bH4sPUA82r28,8102
43
+ ositah-24.12.dev1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
44
+ ositah-24.12.dev1.dist-info/entry_points.txt,sha256=t9oDDLUO1LwHJewlE862LbJMHpDTEyqbeUAPw_F7Q3I,44
45
+ ositah-24.12.dev1.dist-info/top_level.txt,sha256=3kfj_oK4xoZFt0nsw6KKT_aoqshELBu0ryLXECbcqNI,7
46
+ ositah-24.12.dev1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (73.0.1)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5