forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -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"]:
|
||||
|
@ -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]:
|
||||
|
@ -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"""<span title="absences du { cur_sem["date_debut"] } au { cur_sem["date_fin"] }">({sco_preferences.get_preference("assi_metrique", None)})
|
||||
f"""<span title="absences du { cur_sem["date_debut"] } au { cur_sem["date_fin"] }">({sco_preferences.ASSIDUITES_METRIC_LABEL_SHORT.get(sco_preferences.get_preference("assi_metrique", "demi"))})
|
||||
<br>{ nbabsjust } J., { nbabsnj } N.J.</span>"""
|
||||
)
|
||||
H.append("<ul>")
|
||||
|
@ -66,11 +66,7 @@ def abs_notify(etudid, date):
|
||||
etudid,
|
||||
formsemestre.date_debut.isoformat(),
|
||||
formsemestre.date_fin.isoformat(),
|
||||
scu.translate_assiduites_metric(
|
||||
sco_preferences.get_preference(
|
||||
"assi_metrique", formsemestre.formsemestre_id
|
||||
)
|
||||
),
|
||||
sco_preferences.get_preference("assi_metrique", formsemestre.formsemestre_id),
|
||||
)
|
||||
do_abs_notify(formsemestre, etudid, date, nbabs, nbabsjust)
|
||||
|
||||
|
@ -373,7 +373,7 @@ def get_assiduites_count(etudid, sem):
|
||||
etudid,
|
||||
sem["date_debut_iso"],
|
||||
sem["date_fin_iso"],
|
||||
scu.translate_assiduites_metric(metrique),
|
||||
metrique,
|
||||
)
|
||||
|
||||
|
||||
@ -427,7 +427,7 @@ def invalidate_assiduites_count(etudid, sem):
|
||||
"""Invalidate (clear) cached counts"""
|
||||
date_debut = sem["date_debut_iso"]
|
||||
date_fin = sem["date_fin_iso"]
|
||||
for met in sco_preferences.ASSIDUITES_METRIC_LABEL.values():
|
||||
for met in sco_preferences.ASSIDUITES_METRIC_LABEL_SHORT.values():
|
||||
key = str(etudid) + "_" + date_debut + "_" + date_fin + f"{met}_assiduites"
|
||||
sco_cache.AbsSemEtudCache.delete(key)
|
||||
|
||||
|
@ -198,11 +198,17 @@ def _get_pref_default_value_from_config(name, pref_spec):
|
||||
|
||||
_INSTALLED_FONTS = ", ".join(sco_pdf.get_available_font_names())
|
||||
|
||||
ASSIDUITES_METRIC_LABEL = {
|
||||
ASSIDUITES_METRIC_LABEL_LONG = {
|
||||
# l'ordre est important, c'est celui-du menu. Le defaut en 1er donc.
|
||||
"1/2 J.": "demi",
|
||||
"J.": "journee",
|
||||
"H.": "heure",
|
||||
"demi": "Demi-Journée",
|
||||
"journee": "Journée",
|
||||
"heure": "Heure",
|
||||
}
|
||||
ASSIDUITES_METRIC_LABEL_SHORT = {
|
||||
# l'ordre est important, c'est celui-du menu. Le defaut en 1er donc.
|
||||
"demi": "1/2 J.",
|
||||
"journee": "J.",
|
||||
"heure": "H.",
|
||||
}
|
||||
|
||||
PREF_CATEGORIES = (
|
||||
@ -664,10 +670,10 @@ class BasePreferences(object):
|
||||
(
|
||||
"assi_metrique",
|
||||
{
|
||||
"initvalue": "1/2 J.",
|
||||
"initvalue": "demi",
|
||||
"input_type": "menu",
|
||||
"labels": list(ASSIDUITES_METRIC_LABEL.keys()),
|
||||
"allowed_values": list(ASSIDUITES_METRIC_LABEL.keys()),
|
||||
"labels": list(ASSIDUITES_METRIC_LABEL_LONG.values()),
|
||||
"allowed_values": list(ASSIDUITES_METRIC_LABEL_LONG.keys()),
|
||||
"title": "Métrique de l'assiduité",
|
||||
"explanation": "Unité utilisée dans la fiche étudiante, les bilans et les calculs",
|
||||
"category": "assi",
|
||||
|
@ -251,17 +251,6 @@ def is_period_overlapping(
|
||||
return p_deb < i_fin and p_fin > i_deb
|
||||
|
||||
|
||||
def translate_assiduites_metric(hr_metric) -> str:
|
||||
if hr_metric == "1/2 J.":
|
||||
return "demi"
|
||||
if hr_metric == "J.":
|
||||
return "journee"
|
||||
if hr_metric == "N.":
|
||||
return "compte"
|
||||
if hr_metric == "H.":
|
||||
return "heure"
|
||||
|
||||
|
||||
# Types de modules
|
||||
class ModuleType(IntEnum):
|
||||
"""Code des types de module."""
|
||||
|
@ -125,8 +125,8 @@ class RowAssi(tb.Row):
|
||||
"absent": ["Absences", 0.0, 0.0],
|
||||
}
|
||||
|
||||
assi_metric = sco_preferences.ASSIDUITES_METRIC_LABEL.get(
|
||||
sco_preferences.get_preference("assi_metrique", dept_id=g.scodoc_dept_id)
|
||||
assi_metric = sco_preferences.get_preference(
|
||||
"assi_metrique", dept_id=g.scodoc_dept_id
|
||||
)
|
||||
|
||||
for etat, valeur in retour.items():
|
||||
|
@ -79,9 +79,7 @@ class ScoData:
|
||||
etud.id,
|
||||
self.etud_cur_sem.date_debut.isoformat(),
|
||||
self.etud_cur_sem.date_fin.isoformat(),
|
||||
scu.translate_assiduites_metric(
|
||||
sco_preferences.get_preference("assi_metrique")
|
||||
),
|
||||
sco_preferences.get_preference("assi_metrique"),
|
||||
)
|
||||
self.nbabsnj = self.nbabs - self.nbabsjust
|
||||
else:
|
||||
|
@ -327,8 +327,8 @@ def bilan_etud():
|
||||
date_debut: str = f"{scu.annee_scolaire()}-09-01"
|
||||
date_fin: str = f"{scu.annee_scolaire()+1}-06-30"
|
||||
|
||||
assi_metric = sco_preferences.ASSIDUITES_METRIC_LABEL.get(
|
||||
sco_preferences.get_preference("assi_metrique", dept_id=g.scodoc_dept_id)
|
||||
assi_metric = sco_preferences.get_preference(
|
||||
"assi_metrique", dept_id=g.scodoc_dept_id
|
||||
)
|
||||
|
||||
return HTMLBuilder(
|
||||
@ -840,8 +840,8 @@ def visu_assi_group():
|
||||
|
||||
return render_template(
|
||||
"assiduites/pages/visu_assi.j2",
|
||||
assi_metric=sco_preferences.ASSIDUITES_METRIC_LABEL.get(
|
||||
sco_preferences.get_preference("assi_metrique", dept_id=g.scodoc_dept_id)
|
||||
assi_metric=sco_preferences.get_preference(
|
||||
"assi_metrique", dept_id=g.scodoc_dept_id
|
||||
),
|
||||
date_debut=dates["debut"],
|
||||
date_fin=dates["fin"],
|
||||
|
Loading…
Reference in New Issue
Block a user