diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py
index ed34842a..4a9dfb6d 100644
--- a/app/scodoc/sco_evaluations.py
+++ b/app/scodoc/sco_evaluations.py
@@ -668,10 +668,13 @@ def evaluation_describe(evaluation_id="", edit_in_place=True, link_saisie=True):
group_id = sco_groups.get_default_group(formsemestre_id)
H.append(
f"""(absences ce jour)"""
)
diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py
index a70cb0f4..779ca841 100644
--- a/app/scodoc/sco_moduleimpl_status.py
+++ b/app/scodoc/sco_moduleimpl_status.py
@@ -57,6 +57,7 @@ from app.scodoc import sco_moduleimpl
from app.scodoc import sco_permissions_check
from app.tables import list_etuds
+
# menu evaluation dans moduleimpl
def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str:
"Menu avec actions sur une evaluation"
@@ -139,8 +140,11 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str:
"title": "Absences ce jour",
"endpoint": "absences.EtatAbsencesDate",
"args": {
- "date": E["jour"],
"group_ids": group_id,
+ "desc": E["description"],
+ "jour": E["jour"],
+ "heure_debut": E["heure_debut"],
+ "heure_fin": E["heure_fin"],
},
"enabled": E["jour"],
},
diff --git a/app/templates/assiduites/etat_absence_date.j2 b/app/templates/assiduites/etat_absence_date.j2
new file mode 100644
index 00000000..41c99fe3
--- /dev/null
+++ b/app/templates/assiduites/etat_absence_date.j2
@@ -0,0 +1,36 @@
+
Présence lors de l'évaluation {{eval.title}}
+Réalisé le {{eval.jour}} de {{eval.heure_debut}} à {{eval.heure_fin}}
+
+
+
+
+ Nom
+ |
+
+ Assiduité
+ |
+
+
+
+
+ {% for etud in etudiants %}
+
+
+ {{etud.nom | safe}}
+ |
+
+ {{etud.etat}}
+ |
+
+ {% endfor %}
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/assiduites.py b/app/views/assiduites.py
index 22652d93..978c69c3 100644
--- a/app/views/assiduites.py
+++ b/app/views/assiduites.py
@@ -10,7 +10,7 @@ from app.decorators import (
scodoc,
permission_required,
)
-from app.models import FormSemestre, Identite, ScoDocSiteConfig
+from app.models import FormSemestre, Identite, ScoDocSiteConfig, Assiduite
from app.views import assiduites_bp as bp
from app.views import ScoData
@@ -23,6 +23,8 @@ from app.scodoc import sco_groups_view
from app.scodoc import sco_etud
from app.scodoc import sco_find_etud
from flask_login import current_user
+from app.scodoc import sco_utils as scu
+from app.scodoc import sco_assiduites as scass
CSSSTYLES = html_sco_header.BOOTSTRAP_MULTISELECT_CSS
@@ -284,10 +286,6 @@ def signal_assiduites_group():
Returns:
str: l'html généré
"""
- formsemestre_id: int = request.args.get("formsemestre_id", -1)
- moduleimpl_id: int = request.args.get("moduleimpl_id")
- group_ids: list[int] = request.args.get("group_ids", None)
-
formsemestre_id: int = request.args.get("formsemestre_id", -1)
moduleimpl_id: int = request.args.get("moduleimpl_id")
date: str = request.args.get("jour", datetime.date.today().isoformat())
@@ -314,7 +312,6 @@ def signal_assiduites_group():
group_ids, moduleimpl_id=moduleimpl_id, formsemestre_id=formsemestre_id
)
- # Aucun étudiant WIP
if not groups_infos.members:
return (
html_sco_header.sco_header(page_title="Saisie journalière des Assiduités")
@@ -415,6 +412,77 @@ def signal_assiduites_group():
).build()
+@bp.route("/EtatAbsencesDate")
+@scodoc
+@permission_required(Permission.ScoAbsChange)
+def get_etat_abs_date():
+ evaluation = {
+ "jour": request.args.get("jour"),
+ "heure_debut": request.args.get("heure_debut"),
+ "heure_fin": request.args.get("heure_fin"),
+ "title": request.args.get("desc"),
+ }
+ date: str = evaluation["jour"]
+ group_ids: list[int] = request.args.get("group_ids", None)
+ etudiants: list[dict] = []
+
+ if group_ids is None:
+ group_ids = []
+ else:
+ group_ids = group_ids.split(",")
+ map(str, group_ids)
+
+ groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids)
+
+ etuds = [
+ sco_etud.get_etud_info(etudid=m["etudid"], filled=True)[0]
+ for m in groups_infos.members
+ ]
+
+ date_debut = scu.is_iso_formated(
+ f"{evaluation['jour']}T{evaluation['heure_debut'].replace('h',':')}", True
+ )
+ date_fin = scu.is_iso_formated(
+ f"{evaluation['jour']}T{evaluation['heure_fin'].replace('h',':')}", True
+ )
+
+ assiduites: Assiduite = Assiduite.query.filter(
+ Assiduite.etudid.in_([e["etudid"] for e in etuds])
+ )
+ assiduites = scass.filter_by_date(
+ assiduites, Assiduite, date_debut, date_fin, False
+ )
+
+ for etud in etuds:
+ assi = assiduites.filter_by(etudid=etud["etudid"]).first()
+
+ etat = ""
+ if assi != None and assi.etat != 0:
+ etat = scu.EtatAssiduite.inverse().get(assi.etat).name
+
+ etudiant = {
+ "nom": f'{etud["nomprenom"]}',
+ "etat": etat,
+ }
+
+ etudiants.append(etudiant)
+
+ etudiants = list(sorted(etudiants, key=lambda x: x["nom"]))
+
+ header: str = html_sco_header.sco_header(
+ page_title=evaluation["title"],
+ init_qtip=True,
+ )
+
+ return HTMLBuilder(
+ header,
+ render_template(
+ "assiduites/etat_absence_date.j2", etudiants=etudiants, eval=evaluation
+ ),
+ html_sco_header.sco_footer(),
+ ).build()
+
+
def _module_selector(
formsemestre: FormSemestre, moduleimpl_id: int = None
) -> HTMLElement: