From e8be809dffe3a3d9837b42a33d8f2e98eb21f882 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 23 Dec 2023 13:53:02 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20explications=20sur=20=C3=A9tats=20justi?= =?UTF-8?q?ficatifs=20+=20rename=20sco=5Farchives=5Fformsemestre.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/assiduites.py | 1 + ...mestre.py => sco_archives_formsemestre.py} | 0 app/scodoc/sco_archives_justificatifs.py | 8 ++- app/scodoc/sco_formsemestre_status.py | 7 ++- app/static/css/assiduites.css | 4 ++ .../assiduites/explication_etats_justifs.j2 | 59 +++++++++++++++++++ .../pages/ajout_justificatif_etud.j2 | 2 + .../assiduites/pages/liste_assiduites.j2 | 3 + app/views/notes.py | 10 ++-- tests/unit/test_formsemestre.py | 6 +- 10 files changed, 86 insertions(+), 14 deletions(-) rename app/scodoc/{sco_archive_formsemestre.py => sco_archives_formsemestre.py} (100%) create mode 100644 app/templates/assiduites/explication_etats_justifs.j2 diff --git a/app/models/assiduites.py b/app/models/assiduites.py index 908629bdf..e58e6aff2 100644 --- a/app/models/assiduites.py +++ b/app/models/assiduites.py @@ -503,6 +503,7 @@ class Justificatif(ScoDocModel): archiver: JustificatifArchiver = JustificatifArchiver() filenames = archiver.list_justificatifs(archive_name, self.etudiant) accessible_filenames = [] + # for filename in filenames: if int(filename[1]) == current_user.id or current_user.has_permission( Permission.AbsJustifView diff --git a/app/scodoc/sco_archive_formsemestre.py b/app/scodoc/sco_archives_formsemestre.py similarity index 100% rename from app/scodoc/sco_archive_formsemestre.py rename to app/scodoc/sco_archives_formsemestre.py diff --git a/app/scodoc/sco_archives_justificatifs.py b/app/scodoc/sco_archives_justificatifs.py index f2a50a19d..b0fb1d3ea 100644 --- a/app/scodoc/sco_archives_justificatifs.py +++ b/app/scodoc/sco_archives_justificatifs.py @@ -16,7 +16,9 @@ from app import log class Trace: - """gestionnaire de la trace des fichiers justificatifs""" + """gestionnaire de la trace des fichiers justificatifs + XXX TODO à documenter: rôle et format des fichier strace + """ def __init__(self, path: str) -> None: self.path: str = path + "/_trace.csv" @@ -205,6 +207,7 @@ class JustificatifArchiver(BaseArchiver): ) -> list[tuple[str, int]]: """ Retourne la liste des noms de fichiers dans l'archive donnée + avec l'uid de l'utilisateur ayant saisi le fichier. """ filenames: list[str] = [] archive_id = self.get_id_from_name(etud.id, archive_name, dept_id=etud.dept_id) @@ -212,9 +215,8 @@ class JustificatifArchiver(BaseArchiver): filenames = self.list_archive(archive_id, dept_id=etud.dept_id) trace: Trace = Trace(archive_id) traced = trace.get_trace(filenames) - retour = [(key, value[2]) for key, value in traced.items()] - return retour + return [(key, value[2]) for key, value in traced.items()] def get_justificatif_file(self, archive_name: str, etud: Identite, filename: str): """ diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 0d04b9ac7..7254fc275 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -56,12 +56,11 @@ from app.scodoc.sco_utils import ModuleType from app.scodoc.sco_permissions import Permission from app.scodoc.sco_exceptions import ( ScoValueError, - ScoInvalidDateError, ScoInvalidIdType, ) from app.scodoc import html_sco_header from app.scodoc import htmlutils -from app.scodoc import sco_archives +from app.scodoc import sco_archives_formsemestre from app.scodoc import sco_bulletins from app.scodoc import codes_cursus from app.scodoc import sco_compute_moy @@ -454,7 +453,9 @@ def formsemestre_status_menubar(formsemestre: FormSemestre) -> str: "title": "Documents archivés", "endpoint": "notes.formsemestre_list_archives", "args": {"formsemestre_id": formsemestre_id}, - "enabled": sco_archives.PV_ARCHIVER.list_obj_archives(formsemestre_id), + "enabled": sco_archives_formsemestre.PV_ARCHIVER.list_obj_archives( + formsemestre_id + ), }, ] diff --git a/app/static/css/assiduites.css b/app/static/css/assiduites.css index 2df17893a..10a7508a8 100644 --- a/app/static/css/assiduites.css +++ b/app/static/css/assiduites.css @@ -7,6 +7,7 @@ --color-justi-clair: #48f6ff; --color-justi-attente: yellow; --color-justi-attente-stripe: #29b990; /* pink #fa25cb; */ /* #789dbb;*/ + --color-justi-modifie: rgb(255, 230, 0); --color-justi-invalide: #a84476; --color-nonwork: #badfff; @@ -694,6 +695,9 @@ tr.row-justificatif.valide td.assi-type { tr.row-justificatif.attente td.assi-type { background-color: var(--color-justi-attente); } +tr.row-justificatif.modifie td.assi-type { + background-color: var(--color-justi-modifie); +} tr.row-justificatif.non_valide td.assi-type { background-color: var(--color-justi-invalide); } diff --git a/app/templates/assiduites/explication_etats_justifs.j2 b/app/templates/assiduites/explication_etats_justifs.j2 new file mode 100644 index 000000000..3c1f0903f --- /dev/null +++ b/app/templates/assiduites/explication_etats_justifs.j2 @@ -0,0 +1,59 @@ +{# Explication des états des justificatifs #} + +
+ +
Justificatif valide
+
ayant été considéré comme valide, justifie les absences +ou retards de la période +
+ +
Justificatif soumis
+
en attente de validation. Les absences ne sont pas +encore considérées comme justifiées. +
+ +
Justificatif modifié
+
une information a été ajoutée ou modifiée. Doit être validé avant +d'être pris en en compte. +
+ +
Justificatif invalide
+
proposé mais considéré comme non valide. +Les absences ne sont pas justifiées. +
+ +
+ + \ No newline at end of file diff --git a/app/templates/assiduites/pages/ajout_justificatif_etud.j2 b/app/templates/assiduites/pages/ajout_justificatif_etud.j2 index e8459cbec..6848cf2a2 100644 --- a/app/templates/assiduites/pages/ajout_justificatif_etud.j2 +++ b/app/templates/assiduites/pages/ajout_justificatif_etud.j2 @@ -120,6 +120,8 @@ div.submit > input { {% endif %} +{% include "assiduites/explication_etats_justifs.j2" %} + {% endblock app_content %} {% block scripts %} diff --git a/app/templates/assiduites/pages/liste_assiduites.j2 b/app/templates/assiduites/pages/liste_assiduites.j2 index 295477484..df630c79e 100644 --- a/app/templates/assiduites/pages/liste_assiduites.j2 +++ b/app/templates/assiduites/pages/liste_assiduites.j2 @@ -4,4 +4,7 @@

Liste de l'assiduité et des justificatifs de {{sco.etud.html_link_fiche()|safe}}

{{tableau | safe }} + +{% include "assiduites/explication_etats_justifs.j2" %} + {% endblock app_content %} diff --git a/app/views/notes.py b/app/views/notes.py index fc1a21811..7f21b2bd6 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -103,7 +103,7 @@ from app.scodoc import html_sco_header from app.pe import pe_view from app.scodoc import sco_apogee_compare from app.scodoc import sco_archives -from app.scodoc import sco_archive_formsemestre +from app.scodoc import sco_archives_formsemestre from app.scodoc import sco_assiduites from app.scodoc import sco_bulletins from app.scodoc import sco_bulletins_pdf @@ -2973,24 +2973,24 @@ sco_publish( ) sco_publish( "/formsemestre_archive", - sco_archive_formsemestre.formsemestre_archive, + sco_archives_formsemestre.formsemestre_archive, Permission.ScoView, methods=["GET", "POST"], ) sco_publish( "/formsemestre_delete_archive", - sco_archive_formsemestre.formsemestre_delete_archive, + sco_archives_formsemestre.formsemestre_delete_archive, Permission.ScoView, methods=["GET", "POST"], ) sco_publish( "/formsemestre_list_archives", - sco_archive_formsemestre.formsemestre_list_archives, + sco_archives_formsemestre.formsemestre_list_archives, Permission.ScoView, ) sco_publish( "/formsemestre_get_archived_file", - sco_archive_formsemestre.formsemestre_get_archived_file, + sco_archives_formsemestre.formsemestre_get_archived_file, Permission.ScoView, ) sco_publish("/view_apo_csv", sco_etape_apogee_view.view_apo_csv, Permission.EditApogee) diff --git a/tests/unit/test_formsemestre.py b/tests/unit/test_formsemestre.py index bc4cb2652..afc1277ef 100644 --- a/tests/unit/test_formsemestre.py +++ b/tests/unit/test_formsemestre.py @@ -10,7 +10,7 @@ from tests.unit import yaml_setup, call_view import app from app.models import Formation, FormSemestre from app.scodoc import ( - sco_archive_formsemestre, + sco_archives_formsemestre, sco_cost_formation, sco_debouche, sco_edit_ue, @@ -182,8 +182,8 @@ def test_formsemestre_misc_views(test_client): assert isinstance(ans, Response) assert ans.status == "200 OK" assert ans.mimetype == scu.JSON_MIMETYPE - ans = sco_archive_formsemestre.formsemestre_archive(formsemestre.id) - ans = sco_archive_formsemestre.formsemestre_list_archives(formsemestre.id) + ans = sco_archives_formsemestre.formsemestre_archive(formsemestre.id) + ans = sco_archives_formsemestre.formsemestre_list_archives(formsemestre.id) # ----- MENU STATISTIQUES ans = sco_report.formsemestre_report_counts(formsemestre.id)