From 825dc6ecb10ab4035803bf79e1c9279b199bad8b Mon Sep 17 00:00:00 2001 From: iziram Date: Tue, 30 May 2023 15:11:09 +0200 Subject: [PATCH] =?UTF-8?q?Assiduites=20:=20pr=C3=A9f=C3=A9rences=20-=20m?= =?UTF-8?q?=C3=A9trique=20+=20lien=20assiduit=C3=A9=20avec=20reste=20scodo?= =?UTF-8?q?c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/bulletin_but.py | 6 + app/models/formsemestre.py | 12 +- app/scodoc/html_sidebar.py | 4 +- app/scodoc/sco_abs.py | 88 +++- app/scodoc/sco_abs_notification.py | 15 +- app/scodoc/sco_bulletins.py | 4 +- app/scodoc/sco_bulletins_json.py | 2 +- app/scodoc/sco_bulletins_xml.py | 3 +- app/scodoc/sco_formsemestre_validation.py | 2 +- app/scodoc/sco_poursuite_dut.py | 2 +- app/scodoc/sco_preferences.py | 13 + app/scodoc/sco_prepajury.py | 2 +- app/scodoc/sco_utils.py | 11 + app/static/js/releve-but.js | 583 ++++++++++++---------- app/templates/sidebar.j2 | 2 +- app/views/__init__.py | 5 +- 16 files changed, 464 insertions(+), 290 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index fc680dbc7..4d0082145 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -386,6 +386,12 @@ class BulletinBUT: semestre_infos["absences"] = { "injustifie": nbabs - nbabsjust, "total": nbabs, + "metrique": { + "H.": "Heure(s)", + "J.": "Journée(s)", + "1/2 J.": "1/2 Jour.", + "N.": "Nombre", + }.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 68399262b..eef4cdd88 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -39,9 +39,11 @@ 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 +from app.scodoc.sco_utils import MONTH_NAMES_ABBREV, translate_assiduites_metric from app.scodoc.sco_vdi import ApoEtapeVDI +from app.scodoc.sco_utils import translate_assiduites_metric + GROUPS_AUTO_ASSIGNMENT_DATA_MAX = 1024 * 1024 # bytes @@ -678,8 +680,12 @@ class FormSemestre(db.Model): """ from app.scodoc import sco_abs - return sco_abs.get_abs_count_in_interval( - etudid, self.date_debut.isoformat(), self.date_fin.isoformat() + metrique = sco_preferences.get_preference("assi_metrique", self.id) + return sco_abs.get_assiduites_count_in_interval( + etudid, + self.date_debut.isoformat(), + self.date_fin.isoformat(), + translate_assiduites_metric(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 b0d4a2348..6d09becc2 100755 --- a/app/scodoc/html_sidebar.py +++ b/app/scodoc/html_sidebar.py @@ -116,10 +116,10 @@ def sidebar(etudid: int = None): ) if etud["cursem"]: cur_sem = etud["cursem"] - nbabs, nbabsjust = sco_abs.get_abs_count(etudid, cur_sem) + nbabs, nbabsjust = sco_abs.get_assiduites_count(etudid, cur_sem) nbabsnj = nbabs - nbabsjust H.append( - f"""(1/2 j.) + f"""({sco_preferences.get_preference("assi_metrique", None)})
{ nbabsjust } J., { nbabsnj } N.J.
""" ) H.append("