forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
import datetime
|
import datetime
|
||||||
import operator
|
|
||||||
import urllib
|
import urllib
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
import time
|
import time
|
||||||
@ -42,6 +41,8 @@ import time
|
|||||||
from flask import url_for, g, request
|
from flask import url_for, g, request
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
|
from app import db
|
||||||
|
from app.models import FormSemestre
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_abs
|
from app.scodoc import sco_abs
|
||||||
@ -65,6 +66,7 @@ JAVASCRIPTS = html_sco_header.BOOTSTRAP_MULTISELECT_JS + [
|
|||||||
|
|
||||||
CSSSTYLES = html_sco_header.BOOTSTRAP_MULTISELECT_CSS
|
CSSSTYLES = html_sco_header.BOOTSTRAP_MULTISELECT_CSS
|
||||||
|
|
||||||
|
|
||||||
# view:
|
# view:
|
||||||
def groups_view(
|
def groups_view(
|
||||||
group_ids=(),
|
group_ids=(),
|
||||||
@ -422,6 +424,13 @@ class DisplayedGroupsInfos(object):
|
|||||||
H.append(f'<input type="hidden" name="group_ids" value="{group_id}"/>')
|
H.append(f'<input type="hidden" name="group_ids" value="{group_id}"/>')
|
||||||
return "\n".join(H)
|
return "\n".join(H)
|
||||||
|
|
||||||
|
def get_formsemestre(self) -> FormSemestre:
|
||||||
|
return (
|
||||||
|
db.session.get(FormSemestre, self.formsemestre_id)
|
||||||
|
if self.formsemestre_id
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Ancien ZScolar.group_list renommé ici en group_table
|
# Ancien ZScolar.group_list renommé ici en group_table
|
||||||
def groups_table(
|
def groups_table(
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
from app.models import Identite, Assiduite, Justificatif
|
from app.models import Identite, Justificatif
|
||||||
from app.tables import table_builder as tb
|
from app.tables import table_builder as tb
|
||||||
import app.scodoc.sco_assiduites as scass
|
import app.scodoc.sco_assiduites as scass
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
@ -65,31 +65,35 @@ class RowAssi(tb.Row):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
bilan_etud = f"{url_for('assiduites.bilan_etud', scodoc_dept=g.scodoc_dept)}?etudid={etud.id}"
|
bilan_etud = url_for(
|
||||||
|
"assiduites.bilan_etud", scodoc_dept=g.scodoc_dept, etudid=etud.id
|
||||||
|
)
|
||||||
self.add_cell(
|
self.add_cell(
|
||||||
"nom_disp",
|
"nom_disp",
|
||||||
"Nom",
|
"Nom",
|
||||||
etud.nom_disp(),
|
etud.nom_disp(),
|
||||||
"identite_detail",
|
"etudinfo",
|
||||||
|
attrs={"id": str(etud.id)},
|
||||||
data={"order": etud.sort_key},
|
data={"order": etud.sort_key},
|
||||||
target=bilan_etud,
|
target=bilan_etud,
|
||||||
target_attrs={"class": "discretelink", "id": str(etud.id)},
|
target_attrs={"class": "discretelink"},
|
||||||
)
|
)
|
||||||
self.add_cell(
|
self.add_cell(
|
||||||
"prenom",
|
"prenom",
|
||||||
"Prénom",
|
"Prénom",
|
||||||
etud.prenom,
|
etud.prenom_str,
|
||||||
"identite_detail",
|
"etudinfo",
|
||||||
|
attrs={"id": str(etud.id)},
|
||||||
data={"order": etud.sort_key},
|
data={"order": etud.sort_key},
|
||||||
target=bilan_etud,
|
target=bilan_etud,
|
||||||
target_attrs={"class": "discretelink", "id": str(etud.id)},
|
target_attrs={"class": "discretelink"},
|
||||||
)
|
)
|
||||||
stats = self._get_etud_stats(etud)
|
stats = self._get_etud_stats(etud)
|
||||||
for key, value in stats.items():
|
for key, value in stats.items():
|
||||||
self.add_cell(key, value[0], f"{value[1] - value[2]}", "assi_stats")
|
self.add_cell(key, value[0], f"{value[1] - value[2]}", "assi_stats")
|
||||||
self.add_cell(
|
self.add_cell(
|
||||||
key + "_justi",
|
key + "_justi",
|
||||||
value[0] + " Justifiée(s)",
|
value[0] + " Justifiées",
|
||||||
f"{value[2]}",
|
f"{value[2]}",
|
||||||
"assi_stats",
|
"assi_stats",
|
||||||
)
|
)
|
||||||
@ -102,9 +106,9 @@ class RowAssi(tb.Row):
|
|||||||
|
|
||||||
def _get_etud_stats(self, etud: Identite) -> dict[str, list[str, float, float]]:
|
def _get_etud_stats(self, etud: Identite) -> dict[str, list[str, float, float]]:
|
||||||
retour: dict[str, tuple[str, float, float]] = {
|
retour: dict[str, tuple[str, float, float]] = {
|
||||||
"present": ["Présence(s)", 0.0, 0.0],
|
"present": ["Présences", 0.0, 0.0],
|
||||||
"retard": ["Retard(s)", 0.0, 0.0],
|
"retard": ["Retards", 0.0, 0.0],
|
||||||
"absent": ["Absence(s)", 0.0, 0.0],
|
"absent": ["Absences", 0.0, 0.0],
|
||||||
}
|
}
|
||||||
|
|
||||||
assi_metric = {
|
assi_metric = {
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
|
{% extends "sco_page.j2" %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
{{ super() }}
|
||||||
|
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block app_content %}
|
||||||
|
|
||||||
<h2>Visualisation de l'assiduité {{gr_tit|safe}}</h2>
|
<h2>Visualisation de l'assiduité {{gr_tit|safe}}</h2>
|
||||||
|
|
||||||
<div class="stats-inputs">
|
<div class="stats-inputs">
|
||||||
<label class="stats-label"> Date de début<input type="date" name="stats_date_debut" id="stats_date_debut"
|
<label class="stats-label"> Date de début <input type="date" name="stats_date_debut" id="stats_date_debut"
|
||||||
value="{{date_debut}}"></label>
|
value="{{date_debut}}"></label>
|
||||||
<label class="stats-label"> Date de fin<input type="date" name="stats_date_fin" id="stats_date_fin"
|
<label class="stats-label"> Date de fin <input type="date" name="stats_date_fin" id="stats_date_fin"
|
||||||
value="{{date_fin}}"></label>
|
value="{{date_fin}}"></label>
|
||||||
<button onclick="stats()">Changer la période</button>
|
<button onclick="stats()">Changer</button>
|
||||||
|
|
||||||
|
<a style="margin-left:32px;" href="{{request.url}}&format=xlsx">{{scu.ICON_XLS|safe}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{tableau | safe}}
|
{{tableau | safe}}
|
||||||
@ -26,4 +37,6 @@
|
|||||||
document.querySelector('#stats_date_fin').value = date_fin;
|
document.querySelector('#stats_date_fin').value = date_fin;
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
@ -649,6 +649,7 @@ def visu_assi_group():
|
|||||||
"debut": request.args.get("date_debut"),
|
"debut": request.args.get("date_debut"),
|
||||||
"fin": request.args.get("date_fin"),
|
"fin": request.args.get("date_fin"),
|
||||||
}
|
}
|
||||||
|
fmt = request.args.get("format", "html")
|
||||||
|
|
||||||
group_ids: list[int] = request.args.get("group_ids", None)
|
group_ids: list[int] = request.args.get("group_ids", None)
|
||||||
etudiants: list[dict] = []
|
etudiants: list[dict] = []
|
||||||
@ -662,14 +663,16 @@ def visu_assi_group():
|
|||||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids)
|
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids)
|
||||||
|
|
||||||
etuds = etuds_sorted_from_ids([m["etudid"] for m in groups_infos.members])
|
etuds = etuds_sorted_from_ids([m["etudid"] for m in groups_infos.members])
|
||||||
|
|
||||||
header: str = html_sco_header.sco_header(
|
|
||||||
page_title="Visualisation des assiduités",
|
|
||||||
init_qtip=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
table: TableAssi = TableAssi(etuds=etuds, dates=list(dates.values()))
|
table: TableAssi = TableAssi(etuds=etuds, dates=list(dates.values()))
|
||||||
|
|
||||||
|
if fmt.startswith("xls"):
|
||||||
|
return scu.send_file(
|
||||||
|
table.excel(),
|
||||||
|
filename=f"assiduite-{groups_infos.groups_filename}",
|
||||||
|
mime=scu.XLSX_MIMETYPE,
|
||||||
|
suffix=scu.XLSX_SUFFIX,
|
||||||
|
)
|
||||||
|
|
||||||
if groups_infos.tous_les_etuds_du_sem:
|
if groups_infos.tous_les_etuds_du_sem:
|
||||||
gr_tit = "en"
|
gr_tit = "en"
|
||||||
else:
|
else:
|
||||||
@ -681,18 +684,16 @@ def visu_assi_group():
|
|||||||
grp + ' <span class="fontred">' + groups_infos.groups_titles + "</span>"
|
grp + ' <span class="fontred">' + groups_infos.groups_titles + "</span>"
|
||||||
)
|
)
|
||||||
|
|
||||||
return HTMLBuilder(
|
return render_template(
|
||||||
header,
|
"assiduites/pages/visu_assi.j2",
|
||||||
render_template(
|
tableau=table.html(),
|
||||||
"assiduites/pages/visu_assi.j2",
|
gr_tit=gr_tit,
|
||||||
tableau=table.html(),
|
date_debut=dates["debut"],
|
||||||
gr_tit=gr_tit,
|
date_fin=dates["fin"],
|
||||||
date_debut=dates["debut"],
|
group_ids=request.args.get("group_ids", None),
|
||||||
date_fin=dates["fin"],
|
sco=ScoData(formsemestre=groups_infos.get_formsemestre()),
|
||||||
group_ids=request.args.get("group_ids", None),
|
title=f"Assiduité {grp} {groups_infos.groups_titles}",
|
||||||
),
|
)
|
||||||
html_sco_header.sco_footer(),
|
|
||||||
).build()
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/SignalAssiduiteDifferee")
|
@bp.route("/SignalAssiduiteDifferee")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.6.2"
|
SCOVERSION = "9.6.3"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user