From b28ffdd7a8854371fd057b9644a32b5c262d7f08 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 18 Nov 2021 22:46:18 +0100 Subject: [PATCH] WIP: Editions formations --- app/comp/moy_ue.py | 6 ++++- app/static/css/table_editor.css | 28 +++++++++++++++++++-- app/templates/pn/form_modules_ue_coefs.html | 28 ++++++++------------- app/views/pn_modules.py | 27 ++++++++++---------- tests/unit/test_but_modules.py | 2 +- 5 files changed, 57 insertions(+), 34 deletions(-) diff --git a/app/comp/moy_ue.py b/app/comp/moy_ue.py index 6a0ca770..dca7b6fb 100644 --- a/app/comp/moy_ue.py +++ b/app/comp/moy_ue.py @@ -39,9 +39,13 @@ def df_load_ue_coefs(formation_id: int, semestre_idx: int) -> pd.DataFrame: rows = UEs, columns = modules, value = coef. On considère toutes les UE et modules du semestre. Unspecified coefs (not defined in db) are set to zero. + Si semestre_idx None, prend toutes les UE de la formation. """ ues = models.UniteEns.query.filter_by(formation_id=formation_id) modules = models.Module.query.filter_by(formation_id=formation_id) + if semestre_idx is not None: + ues = ues.filter_by(semestre_idx=semestre_idx) + modules = modules.filter_by(semestre_id=semestre_idx) ue_ids = [ue.id for ue in ues] module_ids = [module.id for module in modules] df = pd.DataFrame(columns=module_ids, index=ue_ids, dtype=float) @@ -52,4 +56,4 @@ def df_load_ue_coefs(formation_id: int, semestre_idx: int) -> pd.DataFrame: ): df[mod_coef.module_id][mod_coef.ue_id] = mod_coef.coef df.fillna(value=0, inplace=True) - return df + return df, ues, modules diff --git a/app/static/css/table_editor.css b/app/static/css/table_editor.css index 40f8738f..5cd8c068 100644 --- a/app/static/css/table_editor.css +++ b/app/static/css/table_editor.css @@ -1,12 +1,15 @@ /* table_editor, par Sébastien L. */ - +form.semestre_selector { + margin-top: 2ex; +} /***************************/ /* Le tableau */ /***************************/ .tableau{ display: grid; grid-auto-rows: minmax(24px, auto); + grid-template-columns: fit-content(50px); gap: 2px; margin-top: 5px; background: #fffefa; @@ -27,7 +30,28 @@ [data-editable="true"]{ cursor: pointer; } - +/*****************/ +/* Styles ScoDoc */ +/*****************/ +div.title_ue { + background-color: #b7d2fa; +} +.tableau>div.title_mod { + +} +div.title_RESSOURCE { + background-color: #f8c844; +} +div.title_SAE { + background-color: #c6ffab; +} +div.title_STANDARD, .champs_STANDARD { + background-color: #fefefe; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='32' viewBox='0 0 16 32'%3E%3Cg fill='%239C92AC' fill-opacity='0.21'%3E%3Cpath fill-rule='evenodd' d='M0 24h4v2H0v-2zm0 4h6v2H0v-2zm0-8h2v2H0v-2zM0 0h4v2H0V0zm0 4h2v2H0V4zm16 20h-6v2h6v-2zm0 4H8v2h8v-2zm0-8h-4v2h4v-2zm0-20h-6v2h6V0zm0 4h-4v2h4V4zm-2 12h2v2h-2v-2zm0-8h2v2h-2V8zM2 8h10v2H2V8zm0 8h10v2H2v-2zm-2-4h14v2H0v-2zm4-8h6v2H4V4zm0 16h6v2H4v-2zM6 0h2v2H6V0zm0 24h2v2H6v-2z'/%3E%3C/g%3E%3C/svg%3E"); +} +div.title_MALUS { + background-color: #ff4700; +} /***************************/ /* Statut des cellules */ /***************************/ diff --git a/app/templates/pn/form_modules_ue_coefs.html b/app/templates/pn/form_modules_ue_coefs.html index 01df62af..c94fe60c 100644 --- a/app/templates/pn/form_modules_ue_coefs.html +++ b/app/templates/pn/form_modules_ue_coefs.html @@ -1,8 +1,14 @@ -
Semestre: +

Édition des coefficients des modules vers les UEs

+
+ Double-cliquer pour changer une valeur. + Les valeurs sont automatiquement enregistrées au fur et à mesure. +
+Semestre: -
- Édition des coefficients des modules veers les UE du semestre courant. - Double-cliquer pour changer une valeur. - Les valeurs sont automatiquement enregistrées au fur et à mesure. -
-