Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
10 changed files with 86 additions and 14 deletions
Showing only changes of commit e8be809dff - Show all commits

View File

@ -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

View File

@ -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):
"""

View File

@ -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
),
},
]

View File

@ -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);
}

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 %}
</div>
{% include "assiduites/explication_etats_justifs.j2" %}
{% endblock app_content %}
{% block scripts %}

View File

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

View File

@ -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)

View File

@ -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)