1
0
forked from ScoDoc/ScoDoc

Ajout explications sur états justificatifs + rename sco_archives_formsemestre.py

This commit is contained in:
Emmanuel Viennet 2023-12-23 13:53:02 +01:00
parent 4d513bf318
commit e8be809dff
10 changed files with 86 additions and 14 deletions

View File

@ -503,6 +503,7 @@ class Justificatif(ScoDocModel):
archiver: JustificatifArchiver = JustificatifArchiver() archiver: JustificatifArchiver = JustificatifArchiver()
filenames = archiver.list_justificatifs(archive_name, self.etudiant) filenames = archiver.list_justificatifs(archive_name, self.etudiant)
accessible_filenames = [] accessible_filenames = []
#
for filename in filenames: for filename in filenames:
if int(filename[1]) == current_user.id or current_user.has_permission( if int(filename[1]) == current_user.id or current_user.has_permission(
Permission.AbsJustifView Permission.AbsJustifView

View File

@ -16,7 +16,9 @@ from app import log
class Trace: 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: def __init__(self, path: str) -> None:
self.path: str = path + "/_trace.csv" self.path: str = path + "/_trace.csv"
@ -205,6 +207,7 @@ class JustificatifArchiver(BaseArchiver):
) -> list[tuple[str, int]]: ) -> list[tuple[str, int]]:
""" """
Retourne la liste des noms de fichiers dans l'archive donnée 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] = [] filenames: list[str] = []
archive_id = self.get_id_from_name(etud.id, archive_name, dept_id=etud.dept_id) 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) filenames = self.list_archive(archive_id, dept_id=etud.dept_id)
trace: Trace = Trace(archive_id) trace: Trace = Trace(archive_id)
traced = trace.get_trace(filenames) 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): def get_justificatif_file(self, archive_name: str, etud: Identite, filename: str):
""" """

View File

@ -56,12 +56,11 @@ from app.scodoc.sco_utils import ModuleType
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_exceptions import ( from app.scodoc.sco_exceptions import (
ScoValueError, ScoValueError,
ScoInvalidDateError,
ScoInvalidIdType, ScoInvalidIdType,
) )
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
from app.scodoc import htmlutils 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 sco_bulletins
from app.scodoc import codes_cursus from app.scodoc import codes_cursus
from app.scodoc import sco_compute_moy from app.scodoc import sco_compute_moy
@ -454,7 +453,9 @@ def formsemestre_status_menubar(formsemestre: FormSemestre) -> str:
"title": "Documents archivés", "title": "Documents archivés",
"endpoint": "notes.formsemestre_list_archives", "endpoint": "notes.formsemestre_list_archives",
"args": {"formsemestre_id": formsemestre_id}, "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
),
}, },
] ]

View File

@ -7,6 +7,7 @@
--color-justi-clair: #48f6ff; --color-justi-clair: #48f6ff;
--color-justi-attente: yellow; --color-justi-attente: yellow;
--color-justi-attente-stripe: #29b990; /* pink #fa25cb; */ /* #789dbb;*/ --color-justi-attente-stripe: #29b990; /* pink #fa25cb; */ /* #789dbb;*/
--color-justi-modifie: rgb(255, 230, 0);
--color-justi-invalide: #a84476; --color-justi-invalide: #a84476;
--color-nonwork: #badfff; --color-nonwork: #badfff;
@ -694,6 +695,9 @@ tr.row-justificatif.valide td.assi-type {
tr.row-justificatif.attente td.assi-type { tr.row-justificatif.attente td.assi-type {
background-color: var(--color-justi-attente); 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 { tr.row-justificatif.non_valide td.assi-type {
background-color: var(--color-justi-invalide); background-color: var(--color-justi-invalide);
} }

View File

@ -0,0 +1,59 @@
{# Explication des états des justificatifs #}
<div class="explication-etats-justifs">
<div class="valide">Justificatif valide</div>
<div class="legend">ayant été considéré comme valide, justifie les absences
ou retards de la période
</div>
<div class="attente">Justificatif soumis</div>
<div class="legend">en attente de validation. Les absences ne sont pas
encore considérées comme justifiées.
</div>
<div class="modifie">Justificatif modifié</div>
<div class="legend">une information a été ajoutée ou modifiée. Doit être validé avant
d'être pris en en compte.
</div>
<div class="invalide">Justificatif invalide</div>
<div class="legend">proposé mais considéré comme non valide.
Les absences ne sont pas justifiées.
</div>
</div>
<style>
.explication-etats-justifs {
margin-top: 32px;
margin-left: 12px;
display: grid;
grid-template-columns: auto 1fr;
}
.explication-etats-justifs > div {
margin-bottom: 8px;
margin-right: 8px;
padding: 6px;
}
.explication-etats-justifs div.legend {
font-style: italic;
}
.valide {
background-color: var(--color-justi);
}
.attente {
background-color: var(--color-justi-attente);
}
.modifie {
background-color: var(--color-justi-modifie);
}
.invalide {
background-color: var(--color-justi-invalide);
}
</style>

View File

@ -120,6 +120,8 @@ div.submit > input {
{% endif %} {% endif %}
</div> </div>
{% include "assiduites/explication_etats_justifs.j2" %}
{% endblock app_content %} {% endblock app_content %}
{% block scripts %} {% block scripts %}

View File

@ -4,4 +4,7 @@
<h2>Liste de l'assiduité et des justificatifs de {{sco.etud.html_link_fiche()|safe}}</h2> <h2>Liste de l'assiduité et des justificatifs de {{sco.etud.html_link_fiche()|safe}}</h2>
{{tableau | safe }} {{tableau | safe }}
</div> </div>
{% include "assiduites/explication_etats_justifs.j2" %}
{% endblock app_content %} {% endblock app_content %}

View File

@ -103,7 +103,7 @@ from app.scodoc import html_sco_header
from app.pe import pe_view from app.pe import pe_view
from app.scodoc import sco_apogee_compare from app.scodoc import sco_apogee_compare
from app.scodoc import sco_archives 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_assiduites
from app.scodoc import sco_bulletins from app.scodoc import sco_bulletins
from app.scodoc import sco_bulletins_pdf from app.scodoc import sco_bulletins_pdf
@ -2973,24 +2973,24 @@ sco_publish(
) )
sco_publish( sco_publish(
"/formsemestre_archive", "/formsemestre_archive",
sco_archive_formsemestre.formsemestre_archive, sco_archives_formsemestre.formsemestre_archive,
Permission.ScoView, Permission.ScoView,
methods=["GET", "POST"], methods=["GET", "POST"],
) )
sco_publish( sco_publish(
"/formsemestre_delete_archive", "/formsemestre_delete_archive",
sco_archive_formsemestre.formsemestre_delete_archive, sco_archives_formsemestre.formsemestre_delete_archive,
Permission.ScoView, Permission.ScoView,
methods=["GET", "POST"], methods=["GET", "POST"],
) )
sco_publish( sco_publish(
"/formsemestre_list_archives", "/formsemestre_list_archives",
sco_archive_formsemestre.formsemestre_list_archives, sco_archives_formsemestre.formsemestre_list_archives,
Permission.ScoView, Permission.ScoView,
) )
sco_publish( sco_publish(
"/formsemestre_get_archived_file", "/formsemestre_get_archived_file",
sco_archive_formsemestre.formsemestre_get_archived_file, sco_archives_formsemestre.formsemestre_get_archived_file,
Permission.ScoView, Permission.ScoView,
) )
sco_publish("/view_apo_csv", sco_etape_apogee_view.view_apo_csv, Permission.EditApogee) sco_publish("/view_apo_csv", sco_etape_apogee_view.view_apo_csv, Permission.EditApogee)

View File

@ -10,7 +10,7 @@ from tests.unit import yaml_setup, call_view
import app import app
from app.models import Formation, FormSemestre from app.models import Formation, FormSemestre
from app.scodoc import ( from app.scodoc import (
sco_archive_formsemestre, sco_archives_formsemestre,
sco_cost_formation, sco_cost_formation,
sco_debouche, sco_debouche,
sco_edit_ue, sco_edit_ue,
@ -182,8 +182,8 @@ def test_formsemestre_misc_views(test_client):
assert isinstance(ans, Response) assert isinstance(ans, Response)
assert ans.status == "200 OK" assert ans.status == "200 OK"
assert ans.mimetype == scu.JSON_MIMETYPE assert ans.mimetype == scu.JSON_MIMETYPE
ans = sco_archive_formsemestre.formsemestre_archive(formsemestre.id) ans = sco_archives_formsemestre.formsemestre_archive(formsemestre.id)
ans = sco_archive_formsemestre.formsemestre_list_archives(formsemestre.id) ans = sco_archives_formsemestre.formsemestre_list_archives(formsemestre.id)
# ----- MENU STATISTIQUES # ----- MENU STATISTIQUES
ans = sco_report.formsemestre_report_counts(formsemestre.id) ans = sco_report.formsemestre_report_counts(formsemestre.id)