From afe2caac2d98daeaeecc4573e5d0f09728b38c05 Mon Sep 17 00:00:00 2001 From: iziram Date: Mon, 14 Aug 2023 10:04:08 +0200 Subject: [PATCH] Assiduites : metrique interne externe --- app/but/bulletin_but.py | 8 +++----- app/models/formsemestre.py | 9 ++------- app/scodoc/html_sidebar.py | 2 +- app/scodoc/sco_abs_notification.py | 6 +----- app/scodoc/sco_assiduites.py | 4 ++-- app/scodoc/sco_preferences.py | 20 +++++++++++++------- app/scodoc/sco_utils.py | 11 ----------- app/tables/visu_assiduites.py | 4 ++-- app/views/__init__.py | 4 +--- app/views/assiduites.py | 8 ++++---- 10 files changed, 29 insertions(+), 47 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index 3231cc88..f2a3b744 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -387,11 +387,9 @@ class BulletinBUT: semestre_infos["absences"] = { "injustifie": nbabs - nbabsjust, "total": nbabs, - "metrique": { - "H.": "Heure(s)", - "J.": "Journée(s)", - "1/2 J.": "1/2 Jour.", - }.get(sco_preferences.get_preference("assi_metrique")), + "metrique": sco_preferences.ASSIDUITES_METRIC_LABEL_LONG.get( + sco_preferences.get_preference("assi_metrique") + ), } decisions_ues = self.res.get_etud_decisions_ue(etud.id) or {} if self.prefs["bul_show_ects"]: diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index e4690a06..af856f75 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -39,11 +39,9 @@ from app.models.validations import ScolarFormSemestreValidation from app.scodoc import codes_cursus, sco_preferences from app.scodoc.sco_exceptions import ScoValueError from app.scodoc.sco_permissions import Permission -from app.scodoc.sco_utils import MONTH_NAMES_ABBREV, translate_assiduites_metric +from app.scodoc.sco_utils import MONTH_NAMES_ABBREV from app.scodoc.sco_vdi import ApoEtapeVDI -from app.scodoc.sco_utils import translate_assiduites_metric - GROUPS_AUTO_ASSIGNMENT_DATA_MAX = 1024 * 1024 # bytes @@ -718,10 +716,7 @@ class FormSemestre(db.Model): metrique = sco_preferences.get_preference("assi_metrique", self.id) return sco_assiduites.get_assiduites_count_in_interval( - etudid, - self.date_debut.isoformat(), - self.date_fin.isoformat(), - translate_assiduites_metric(metrique), + etudid, self.date_debut.isoformat(), self.date_fin.isoformat(), metrique ) def get_codes_apogee(self, category=None) -> set[str]: diff --git a/app/scodoc/html_sidebar.py b/app/scodoc/html_sidebar.py index 820bf898..72310acd 100755 --- a/app/scodoc/html_sidebar.py +++ b/app/scodoc/html_sidebar.py @@ -122,7 +122,7 @@ def sidebar(etudid: int = None): nbabs, nbabsjust = sco_assiduites.get_assiduites_count(etudid, cur_sem) nbabsnj = nbabs - nbabsjust H.append( - f"""({sco_preferences.get_preference("assi_metrique", None)}) + f"""({sco_preferences.ASSIDUITES_METRIC_LABEL_SHORT.get(sco_preferences.get_preference("assi_metrique", "demi"))})
{ nbabsjust } J., { nbabsnj } N.J.
""" ) H.append("