Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
Emmanuel Viennet | 18b1f00586 | |
Iziram | 6b985620e9 | |
Iziram | 4d234ba353 | |
Iziram | 5d45fcf656 | |
Iziram | 0a5919b788 | |
Iziram | 09f4525e66 | |
Emmanuel Viennet | 0bc57807de | |
Emmanuel Viennet | 87aaf12d27 | |
Emmanuel Viennet | c8ab9b9b6c | |
Emmanuel Viennet | ad7b48e110 |
|
@ -3,14 +3,15 @@
|
|||
# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved.
|
||||
# See LICENSE
|
||||
##############################################################################
|
||||
"""ScoDoc 9 API : Assiduités
|
||||
"""
|
||||
"""ScoDoc 9 API : Assiduités"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from flask import g, request
|
||||
from flask_json import as_json
|
||||
from flask_login import current_user, login_required
|
||||
from flask_sqlalchemy.query import Query
|
||||
from sqlalchemy.orm.exc import ObjectDeletedError
|
||||
|
||||
from app import db, log, set_sco_dept
|
||||
import app.scodoc.sco_assiduites as scass
|
||||
|
@ -858,7 +859,10 @@ def assiduite_edit(assiduite_id: int):
|
|||
msg=f"assiduite: modif {assiduite_unique}",
|
||||
)
|
||||
db.session.commit()
|
||||
scass.simple_invalidate_cache(assiduite_unique.to_dict())
|
||||
try:
|
||||
scass.simple_invalidate_cache(assiduite_unique.to_dict())
|
||||
except ObjectDeletedError:
|
||||
return json_error(404, "Assiduité supprimée / inexistante")
|
||||
|
||||
return {"OK": True}
|
||||
|
||||
|
|
|
@ -432,6 +432,7 @@ class UniteEns(models.ScoDocModel):
|
|||
self.niveau_competence, parcours
|
||||
)
|
||||
if not ok:
|
||||
self.formation.invalidate_cached_sems()
|
||||
self.niveau_competence = prev_niveau # restore
|
||||
return False, error_message
|
||||
|
||||
|
|
|
@ -230,41 +230,41 @@ def next_iso_day(date):
|
|||
|
||||
def YearTable(
|
||||
year,
|
||||
events=[],
|
||||
events_by_day: dict[str, list[dict]],
|
||||
firstmonth=9,
|
||||
lastmonth=7,
|
||||
halfday=0,
|
||||
dayattributes="",
|
||||
pad_width=8,
|
||||
):
|
||||
# Code simplifié en 2024: utilisé seulement pour calendrier évaluations
|
||||
"""Generate a calendar table
|
||||
events = list of tuples (date, text, color, href [,halfday])
|
||||
where date is a string in ISO format (yyyy-mm-dd)
|
||||
halfday is boolean (true: morning, false: afternoon)
|
||||
text = text to put in calendar (must be short, 1-5 cars) (optional)
|
||||
if halfday, generate 2 cells per day (morning, afternoon)
|
||||
"""
|
||||
T = [
|
||||
'<table id="maincalendar" class="maincalendar" border="3" cellpadding="1" cellspacing="1" frame="box">'
|
||||
"""<table id="maincalendar" class="maincalendar"
|
||||
border="3" cellpadding="1" cellspacing="1" frame="box">"""
|
||||
]
|
||||
T.append("<tr>")
|
||||
month = firstmonth
|
||||
while 1:
|
||||
while True:
|
||||
T.append('<td valign="top">')
|
||||
T.append(MonthTableHead(month))
|
||||
T.append(_month_table_head(month))
|
||||
T.append(
|
||||
MonthTableBody(
|
||||
_month_table_body(
|
||||
month,
|
||||
year,
|
||||
events,
|
||||
halfday,
|
||||
events_by_day,
|
||||
dayattributes,
|
||||
is_work_saturday(),
|
||||
pad_width=pad_width,
|
||||
)
|
||||
)
|
||||
T.append(MonthTableTail())
|
||||
T.append("</td>")
|
||||
T.append(
|
||||
"""
|
||||
</table>
|
||||
</td>"""
|
||||
)
|
||||
if month == lastmonth:
|
||||
break
|
||||
month = month + 1
|
||||
|
@ -322,29 +322,32 @@ WEEKDAYCOLOR = GRAY1
|
|||
WEEKENDCOLOR = GREEN3
|
||||
|
||||
|
||||
def MonthTableHead(month):
|
||||
def _month_table_head(month):
|
||||
color = WHITE
|
||||
return """<table class="monthcalendar" border="0" cellpadding="0" cellspacing="0" frame="box">
|
||||
<tr bgcolor="%s"><td class="calcol" colspan="2" align="center">%s</td></tr>\n""" % (
|
||||
color,
|
||||
MONTHNAMES_ABREV[month - 1],
|
||||
)
|
||||
return f"""<table class="monthcalendar" border="0" cellpadding="0" cellspacing="0" frame="box">
|
||||
<tr bgcolor="{color}">
|
||||
<td class="calcol" colspan="2" align="center">{MONTHNAMES_ABREV[month - 1]}</td>
|
||||
</tr>\n"""
|
||||
|
||||
|
||||
def MonthTableTail():
|
||||
return "</table>\n"
|
||||
|
||||
|
||||
def MonthTableBody(
|
||||
month, year, events=[], halfday=0, trattributes="", work_saturday=False, pad_width=8
|
||||
):
|
||||
def _month_table_body(
|
||||
month,
|
||||
year,
|
||||
events_by_day: dict[str, list[dict]],
|
||||
trattributes="",
|
||||
work_saturday=False,
|
||||
) -> str:
|
||||
"""
|
||||
events : [event]
|
||||
event = [ yyyy-mm-dd, legend, href, color, descr ] XXX
|
||||
"""
|
||||
firstday, nbdays = calendar.monthrange(year, month)
|
||||
localtime = time.localtime()
|
||||
current_weeknum = time.strftime("%U", localtime)
|
||||
current_year = localtime[0]
|
||||
T = []
|
||||
rows = []
|
||||
# cherche date du lundi de la 1ere semaine de ce mois
|
||||
monday = ddmmyyyy("1/%d/%d" % (month, year))
|
||||
monday = ddmmyyyy(f"1/{month}/{year}")
|
||||
while monday.weekday != 0:
|
||||
monday = monday.prev()
|
||||
|
||||
|
@ -353,158 +356,51 @@ def MonthTableBody(
|
|||
else:
|
||||
weekend = ("S", "D")
|
||||
|
||||
if not halfday:
|
||||
for d in range(1, nbdays + 1):
|
||||
weeknum = time.strftime(
|
||||
"%U", time.strptime("%d/%d/%d" % (d, month, year), scu.DATE_FMT)
|
||||
)
|
||||
day = DAYNAMES_ABREV[(firstday + d - 1) % 7]
|
||||
if day in weekend:
|
||||
bgcolor = WEEKENDCOLOR
|
||||
weekclass = "wkend"
|
||||
attrs = ""
|
||||
else:
|
||||
bgcolor = WEEKDAYCOLOR
|
||||
weekclass = "wk" + str(monday).replace("/", "_")
|
||||
attrs = trattributes
|
||||
color = None
|
||||
legend = ""
|
||||
href = ""
|
||||
descr = ""
|
||||
# event this day ?
|
||||
# each event is a tuple (date, text, color, href)
|
||||
# where date is a string in ISO format (yyyy-mm-dd)
|
||||
for ev in events:
|
||||
ev_year = int(ev[0][:4])
|
||||
ev_month = int(ev[0][5:7])
|
||||
ev_day = int(ev[0][8:10])
|
||||
if year == ev_year and month == ev_month and ev_day == d:
|
||||
if ev[1]:
|
||||
legend = ev[1]
|
||||
if ev[2]:
|
||||
color = ev[2]
|
||||
if ev[3]:
|
||||
href = ev[3]
|
||||
if len(ev) > 4 and ev[4]:
|
||||
descr = ev[4]
|
||||
#
|
||||
cc = []
|
||||
if color is not None:
|
||||
cc.append('<td bgcolor="%s" class="calcell">' % color)
|
||||
else:
|
||||
cc.append('<td class="calcell">')
|
||||
|
||||
for d in range(1, nbdays + 1):
|
||||
weeknum = time.strftime(
|
||||
"%U", time.strptime("%d/%d/%d" % (d, month, year), scu.DATE_FMT)
|
||||
)
|
||||
day = DAYNAMES_ABREV[(firstday + d - 1) % 7]
|
||||
if day in weekend:
|
||||
bgcolor = WEEKENDCOLOR
|
||||
weekclass = "wkend"
|
||||
attrs = ""
|
||||
else:
|
||||
bgcolor = WEEKDAYCOLOR
|
||||
weekclass = "wk" + str(monday).replace("/", "_")
|
||||
attrs = trattributes
|
||||
# events this day ?
|
||||
events = events_by_day.get(f"{year}-{month:02}-{d:02}", [])
|
||||
color = None
|
||||
ev_txts = []
|
||||
for ev in events:
|
||||
color = ev.get("color")
|
||||
href = ev.get("href", "")
|
||||
description = ev.get("description", "")
|
||||
if href:
|
||||
href = 'href="%s"' % href
|
||||
if descr:
|
||||
descr = 'title="%s"' % html.escape(descr, quote=True)
|
||||
if href or descr:
|
||||
cc.append("<a %s %s>" % (href, descr))
|
||||
|
||||
if legend or d == 1:
|
||||
if pad_width is not None:
|
||||
n = pad_width - len(legend) # pad to 8 cars
|
||||
if n > 0:
|
||||
legend = (
|
||||
" " * (n // 2) + legend + " " * ((n + 1) // 2)
|
||||
)
|
||||
href = f'href="{href}"'
|
||||
if description:
|
||||
description = f"""title="{html.escape(description, quote=True)}" """
|
||||
if href or description:
|
||||
ev_txts.append(f"""<a {href} {description}>{ev.get("title", "")}</a>""")
|
||||
else:
|
||||
legend = " " # empty cell
|
||||
cc.append(legend)
|
||||
if href or descr:
|
||||
cc.append("</a>")
|
||||
cc.append("</td>")
|
||||
cell = "".join(cc)
|
||||
if day == "D":
|
||||
monday = monday.next_day(7)
|
||||
if (
|
||||
weeknum == current_weeknum
|
||||
and current_year == year
|
||||
and weekclass != "wkend"
|
||||
):
|
||||
weekclass += " currentweek"
|
||||
T.append(
|
||||
'<tr bgcolor="%s" class="%s" %s><td class="calday">%d%s</td>%s</tr>'
|
||||
% (bgcolor, weekclass, attrs, d, day, cell)
|
||||
)
|
||||
else:
|
||||
# Calendar with 2 cells / day
|
||||
for d in range(1, nbdays + 1):
|
||||
weeknum = time.strftime(
|
||||
"%U", time.strptime("%d/%d/%d" % (d, month, year), scu.DATE_FMT)
|
||||
)
|
||||
day = DAYNAMES_ABREV[(firstday + d - 1) % 7]
|
||||
if day in weekend:
|
||||
bgcolor = WEEKENDCOLOR
|
||||
weekclass = "wkend"
|
||||
attrs = ""
|
||||
else:
|
||||
bgcolor = WEEKDAYCOLOR
|
||||
weekclass = "wk" + str(monday).replace("/", "_")
|
||||
attrs = trattributes
|
||||
if (
|
||||
weeknum == current_weeknum
|
||||
and current_year == year
|
||||
and weekclass != "wkend"
|
||||
):
|
||||
weeknum += " currentweek"
|
||||
ev_txts.append(ev.get("title", " "))
|
||||
#
|
||||
cc = []
|
||||
if color is not None:
|
||||
cc.append(f'<td bgcolor="{color}" class="calcell">')
|
||||
else:
|
||||
cc.append('<td class="calcell">')
|
||||
|
||||
if day == "D":
|
||||
monday = monday.next_day(7)
|
||||
T.append(
|
||||
'<tr bgcolor="%s" class="wk%s" %s><td class="calday">%d%s</td>'
|
||||
% (bgcolor, weekclass, attrs, d, day)
|
||||
)
|
||||
cc = []
|
||||
for morning in (True, False):
|
||||
color = None
|
||||
legend = ""
|
||||
href = ""
|
||||
descr = ""
|
||||
for ev in events:
|
||||
ev_year = int(ev[0][:4])
|
||||
ev_month = int(ev[0][5:7])
|
||||
ev_day = int(ev[0][8:10])
|
||||
if ev[4] is not None:
|
||||
ev_half = int(ev[4])
|
||||
else:
|
||||
ev_half = 0
|
||||
if (
|
||||
year == ev_year
|
||||
and month == ev_month
|
||||
and ev_day == d
|
||||
and morning == ev_half
|
||||
):
|
||||
if ev[1]:
|
||||
legend = ev[1]
|
||||
if ev[2]:
|
||||
color = ev[2]
|
||||
if ev[3]:
|
||||
href = ev[3]
|
||||
if len(ev) > 5 and ev[5]:
|
||||
descr = ev[5]
|
||||
#
|
||||
if color is not None:
|
||||
cc.append('<td bgcolor="%s" class="calcell">' % (color))
|
||||
else:
|
||||
cc.append('<td class="calcell">')
|
||||
if href:
|
||||
href = 'href="%s"' % href
|
||||
if descr:
|
||||
descr = 'title="%s"' % html.escape(descr, quote=True)
|
||||
if href or descr:
|
||||
cc.append("<a %s %s>" % (href, descr))
|
||||
if legend or d == 1:
|
||||
n = 3 - len(legend) # pad to 3 cars
|
||||
if n > 0:
|
||||
legend = (
|
||||
" " * (n // 2) + legend + " " * ((n + 1) // 2)
|
||||
)
|
||||
else:
|
||||
legend = " " # empty cell
|
||||
cc.append(legend)
|
||||
if href or descr:
|
||||
cc.append("</a>")
|
||||
cc.append("</td>\n")
|
||||
T.append("".join(cc) + "</tr>")
|
||||
return "\n".join(T)
|
||||
cc.append(f"{', '.join(ev_txts)}</td>")
|
||||
cells = "".join(cc)
|
||||
if day == "D":
|
||||
monday = monday.next_day(7)
|
||||
if weeknum == current_weeknum and current_year == year and weekclass != "wkend":
|
||||
weekclass += " currentweek"
|
||||
rows.append(
|
||||
f"""<tr bgcolor="{bgcolor}" class="{weekclass}" {attrs}>
|
||||
<td class="calday">{d}{day}</td>{cells}</tr>"""
|
||||
)
|
||||
|
||||
return "\n".join(rows)
|
||||
|
|
|
@ -360,6 +360,7 @@ def do_evaluation_etat_in_mod(nt, modimpl: ModuleImpl):
|
|||
return etat
|
||||
|
||||
|
||||
# View
|
||||
def formsemestre_evaluations_cal(formsemestre_id):
|
||||
"""Page avec calendrier de toutes les evaluations de ce semestre"""
|
||||
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
||||
|
@ -373,22 +374,17 @@ def formsemestre_evaluations_cal(formsemestre_id):
|
|||
color_futur = "#70E0FF"
|
||||
|
||||
year = formsemestre.annee_scolaire()
|
||||
events = {} # (day, halfday) : event
|
||||
events_by_day = collections.defaultdict(list) # date_iso : event
|
||||
for e in evaluations:
|
||||
if e.date_debut is None:
|
||||
continue # éval. sans date
|
||||
txt = e.moduleimpl.module.code or e.moduleimpl.module.abbrev or "éval."
|
||||
if e.date_debut == e.date_fin:
|
||||
heure_debut_txt, heure_fin_txt = "?", "?"
|
||||
heure_debut_txt, heure_fin_txt = "", ""
|
||||
else:
|
||||
heure_debut_txt = (
|
||||
e.date_debut.strftime(scu.TIME_FMT) if e.date_debut else "?"
|
||||
e.date_debut.strftime(scu.TIME_FMT) if e.date_debut else ""
|
||||
)
|
||||
heure_fin_txt = e.date_fin.strftime(scu.TIME_FMT) if e.date_fin else "?"
|
||||
|
||||
description = f"""{
|
||||
e.moduleimpl.module.titre
|
||||
}, de {heure_debut_txt} à {heure_fin_txt}"""
|
||||
heure_fin_txt = e.date_fin.strftime(scu.TIME_FMT) if e.date_fin else ""
|
||||
|
||||
# Etat (notes completes) de l'évaluation:
|
||||
modimpl_result = nt.modimpls_results[e.moduleimpl.id]
|
||||
|
@ -398,28 +394,27 @@ def formsemestre_evaluations_cal(formsemestre_id):
|
|||
color = color_incomplete
|
||||
if e.date_debut > datetime.datetime.now(scu.TIME_ZONE):
|
||||
color = color_futur
|
||||
href = url_for(
|
||||
"notes.moduleimpl_status",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
moduleimpl_id=e.moduleimpl_id,
|
||||
)
|
||||
day = e.date_debut.date().isoformat() # yyyy-mm-dd
|
||||
event = events.get(day)
|
||||
if not event:
|
||||
events[day] = [day, txt, color, href, description, e.moduleimpl]
|
||||
else:
|
||||
if event[-1].id != e.moduleimpl.id:
|
||||
# plusieurs evals de modules differents a la meme date
|
||||
event[1] += ", " + txt
|
||||
event[4] += ", " + description
|
||||
if color == color_incomplete:
|
||||
event[2] = color_incomplete
|
||||
if color == color_futur:
|
||||
event[2] = color_futur
|
||||
event = {
|
||||
"color": color,
|
||||
"date_iso": day,
|
||||
"title": e.moduleimpl.module.code or e.moduleimpl.module.abbrev or "éval.",
|
||||
"description": f"""{e.description or e.moduleimpl.module.titre_str()}"""
|
||||
+ (
|
||||
f""" de {heure_debut_txt} à {heure_fin_txt}"""
|
||||
if heure_debut_txt
|
||||
else ""
|
||||
),
|
||||
"href": url_for(
|
||||
"notes.moduleimpl_status",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
moduleimpl_id=e.moduleimpl_id,
|
||||
),
|
||||
"modimpl": e.moduleimpl,
|
||||
}
|
||||
events_by_day[day].append(event)
|
||||
|
||||
cal_html = sco_cal.YearTable(
|
||||
year, events=list(events.values()), halfday=False, pad_width=None
|
||||
)
|
||||
cal_html = sco_cal.YearTable(year, events_by_day=events_by_day)
|
||||
|
||||
return f"""
|
||||
{
|
||||
|
|
|
@ -611,16 +611,17 @@ class BasePreferences:
|
|||
"explanation": "toute saisie d'absence doit indiquer le module concerné",
|
||||
},
|
||||
),
|
||||
# (
|
||||
# "forcer_present",
|
||||
# {
|
||||
# "initvalue": 0,
|
||||
# "title": "Forcer l'appel des présents",
|
||||
# "input_type": "boolcheckbox",
|
||||
# "labels": ["non", "oui"],
|
||||
# "category": "assi",
|
||||
# },
|
||||
# ),
|
||||
(
|
||||
"non_present",
|
||||
{
|
||||
"initvalue": 0,
|
||||
"title": "Désactiver la saisie des présences",
|
||||
"input_type": "boolcheckbox",
|
||||
"labels": ["non", "oui"],
|
||||
"category": "assi",
|
||||
"explanation": "Désactive la saisie et l'affichage des présences",
|
||||
},
|
||||
),
|
||||
(
|
||||
"periode_defaut",
|
||||
{
|
||||
|
@ -644,18 +645,18 @@ class BasePreferences:
|
|||
"category": "assi",
|
||||
},
|
||||
),
|
||||
(
|
||||
"assi_etat_defaut",
|
||||
{
|
||||
"explanation": "⚠ non fonctionnel, travaux en cours !",
|
||||
"initvalue": "aucun",
|
||||
"input_type": "menu",
|
||||
"labels": ["aucun", "present", "retard", "absent"],
|
||||
"allowed_values": ["aucun", "present", "retard", "absent"],
|
||||
"title": "Définir l'état par défaut",
|
||||
"category": "assi",
|
||||
},
|
||||
),
|
||||
# (
|
||||
# "assi_etat_defaut",
|
||||
# {
|
||||
# "explanation": "⚠ non fonctionnel, travaux en cours !",
|
||||
# "initvalue": "aucun",
|
||||
# "input_type": "menu",
|
||||
# "labels": ["aucun", "present", "retard", "absent"],
|
||||
# "allowed_values": ["aucun", "present", "retard", "absent"],
|
||||
# "title": "Définir l'état par défaut",
|
||||
# "category": "assi",
|
||||
# },
|
||||
# ),
|
||||
(
|
||||
"non_travail",
|
||||
{
|
||||
|
|
|
@ -730,31 +730,11 @@ tr.row-justificatif.non_valide td.assi-type {
|
|||
background-color: var(--color-defaut) !important;
|
||||
}
|
||||
|
||||
.color.est_just.sans_etat::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
background-color: var(--color-justi) !important;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.color.invalide::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
right: 0;
|
||||
.color.invalide {
|
||||
background-color: var(--color-justi-invalide) !important;
|
||||
}
|
||||
|
||||
.color.attente::before,
|
||||
.color.modifie::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
right: 0;
|
||||
.color.attente {
|
||||
background: repeating-linear-gradient(to bottom,
|
||||
var(--color-justi-attente-stripe) 0px,
|
||||
var(--color-justi-attente-stripe) 4px,
|
||||
|
@ -762,6 +742,10 @@ tr.row-justificatif.non_valide td.assi-type {
|
|||
var(--color-justi-attente) 7px) !important;
|
||||
}
|
||||
|
||||
.color.est_just {
|
||||
background-color: var(--color-justi) !important;
|
||||
}
|
||||
|
||||
#gtrcontent .pdp {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -296,7 +296,13 @@ function creerLigneEtudiant(etud, index) {
|
|||
// Création des boutons d'assiduités
|
||||
if (readOnly) {
|
||||
} else if (currentAssiduite.type != "conflit") {
|
||||
["present", "retard", "absent"].forEach((abs) => {
|
||||
const etats = ["retard", "absent"];
|
||||
|
||||
if (!window.nonPresent) {
|
||||
etats.splice(0, 0, "present");
|
||||
}
|
||||
|
||||
etats.forEach((abs) => {
|
||||
const btn = document.createElement("input");
|
||||
btn.type = "checkbox";
|
||||
btn.value = abs;
|
||||
|
@ -425,7 +431,7 @@ async function getModuleImpl(assiduite) {
|
|||
return res.json();
|
||||
})
|
||||
.then((data) => {
|
||||
moduleimpls[id] = `${data.module.code} ${data.module.abbrev || ''}`;
|
||||
moduleimpls[id] = `${data.module.code} ${data.module.abbrev || ""}`;
|
||||
return moduleimpls[id];
|
||||
})
|
||||
.catch((_) => {
|
||||
|
@ -531,12 +537,7 @@ async function MiseAJourLigneEtud(etud) {
|
|||
|
||||
async function actionAssiduite(etud, etat, type, assiduite = null) {
|
||||
const modimpl_id = $("#moduleimpl_select").val();
|
||||
if (
|
||||
assiduite &&
|
||||
assiduite.etat.toLowerCase() === etat &&
|
||||
assiduite.moduleimpl_id == modimpl_id
|
||||
)
|
||||
type = "suppression";
|
||||
if (assiduite && assiduite.etat.toLowerCase() === etat) type = "suppression";
|
||||
|
||||
const { deb, fin } = getPeriodAsDate();
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
# See LICENSE
|
||||
##############################################################################
|
||||
|
||||
"""Liste simple d'étudiants
|
||||
"""
|
||||
"""Liste simple d'étudiants"""
|
||||
|
||||
import datetime
|
||||
from flask import g, url_for
|
||||
from app import log
|
||||
|
@ -140,6 +140,13 @@ class RowAssi(tb.Row):
|
|||
)
|
||||
stats = self._get_etud_stats(etud)
|
||||
for key, value in stats.items():
|
||||
if key == "present" and sco_preferences.get_preference(
|
||||
"non_present",
|
||||
dept_id=g.scodoc_dept_id,
|
||||
formsemestre_id=self.table.formsemestre.id,
|
||||
):
|
||||
continue
|
||||
|
||||
self.add_cell(key, value[0], fmt_num(value[1] - value[2]), "assi_stats")
|
||||
if key != "present":
|
||||
self.add_cell(
|
||||
|
|
|
@ -51,8 +51,6 @@ Calendrier de l'assiduité
|
|||
|
||||
<div class="dayline">
|
||||
<div class="dayline-title">
|
||||
<span>Assiduité du</span>
|
||||
<br>
|
||||
<span>{{jour.get_date()}}</span>
|
||||
{{jour.generate_minitimeline() | safe}}
|
||||
</div>
|
||||
|
@ -77,36 +75,7 @@ Calendrier de l'assiduité
|
|||
|
||||
<div class="help">
|
||||
<h3>Calendrier</h3>
|
||||
<p>Code couleur</p>
|
||||
<ul class="couleurs">
|
||||
<li><span title="Vert" class="present demo"></span> → présence de l'étudiant lors de la
|
||||
période
|
||||
</li>
|
||||
<li><span title="Bleu clair" class="nonwork demo"></span> → la période n'est pas travaillée
|
||||
</li>
|
||||
<li><span title="Rouge" class="absent demo"></span> → absence de l'étudiant lors de la
|
||||
période
|
||||
</li>
|
||||
<li><span title="Rose" class="demo color absent est_just"></span> → absence justifiée
|
||||
</li>
|
||||
<li><span title="Orange" class="retard demo"></span> → retard de l'étudiant lors de la
|
||||
période
|
||||
</li>
|
||||
<li><span title="Jaune clair" class="demo color retard est_just"></span> → retard justifié
|
||||
</li>
|
||||
|
||||
<li><span title="Quart Bleu" class="est_just demo"></span> → la période est couverte par un
|
||||
justificatif valide</li>
|
||||
<li><span title="Justif. non valide" class="invalide demo"></span> → la période est
|
||||
couverte par un justificatif non valide
|
||||
</li>
|
||||
<li><span title="Justif. en attente" class="attente demo"></span> → la période
|
||||
a un justificatif en attente de validation
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Vous pouvez passer le curseur sur les jours colorés afin de voir les informations supplémentaires</p>
|
||||
{% include "assiduites/widgets/legende_couleur.j2" %}
|
||||
</div>
|
||||
<ul class="couleurs print">
|
||||
<li><span title="Vert" class="present demo"></span> présence
|
||||
|
@ -158,7 +127,7 @@ Calendrier de l'assiduité
|
|||
|
||||
.calendrier {
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
justify-content: center;
|
||||
overflow-x: scroll;
|
||||
border: 1px solid #444;
|
||||
border-radius: 12px;
|
||||
|
@ -182,21 +151,8 @@ Calendrier de l'assiduité
|
|||
justify-content: start;
|
||||
}
|
||||
|
||||
.demo.invalide {
|
||||
background-color: var(--color-justi-invalide) !important;
|
||||
}
|
||||
|
||||
.demo.attente {
|
||||
background: repeating-linear-gradient(to bottom,
|
||||
var(--color-justi-attente-stripe) 0px,
|
||||
var(--color-justi-attente-stripe) 4px,
|
||||
var(--color-justi-attente) 4px,
|
||||
var(--color-justi-attente) 7px) !important;
|
||||
}
|
||||
|
||||
.demo.est_just {
|
||||
background-color: var(--color-justi) !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.demi .day.nonwork>span {
|
||||
|
|
|
@ -310,8 +310,13 @@ async function nouvellePeriode(period = null) {
|
|||
|
||||
const assi_btns = document.createElement('div');
|
||||
assi_btns.classList.add('assi-btns');
|
||||
const etats = ["retard", "absent"];
|
||||
|
||||
["present", "retard", "absent"].forEach((value) => {
|
||||
if(!window.nonPresent){
|
||||
etats.splice(0,0,"present");
|
||||
}
|
||||
|
||||
etats.forEach((value) => {
|
||||
const cbox = document.createElement("input");
|
||||
cbox.type = "checkbox";
|
||||
cbox.value = value;
|
||||
|
@ -499,6 +504,8 @@ const moduleimpls = new Map();
|
|||
const inscriptionsModules = new Map();
|
||||
const nonWorkDays = [{{ nonworkdays| safe }}];
|
||||
|
||||
window.nonPresent = {{ 'true' if non_present else 'false' }};
|
||||
|
||||
// Vérification du forçage de module
|
||||
window.forceModule = "{{ forcer_module }}" == "True";
|
||||
if (window.forceModule) {
|
||||
|
@ -518,12 +525,29 @@ if (window.forceModule) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
const defaultPlage = {{ nouv_plage | safe}} || [];
|
||||
|
||||
/**
|
||||
* Fonction exécutée au lancement de la page
|
||||
* - On affiche ou non les photos des étudiants
|
||||
* - On vérifie si la date est un jour travaillé
|
||||
*/
|
||||
async function main() {
|
||||
|
||||
// On initialise les sélecteurs avec les valeurs par défaut (si elles existent)
|
||||
if (defaultPlage.every((e) => e)) {
|
||||
$("#date").datepicker("setDate", defaultPlage[0]);
|
||||
$("#debut").val(defaultPlage[1]);
|
||||
$("#fin").val(defaultPlage[2]);
|
||||
|
||||
// On ajoute la période si la date est un jour travaillé
|
||||
if(dateCouranteEstTravaillee()){
|
||||
await nouvellePeriode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const checked = localStorage.getItem("scodoc-etud-pdp") == "true";
|
||||
afficherPDP(checked);
|
||||
$("#date").on("change", async function (d) {
|
||||
|
@ -532,7 +556,7 @@ async function main() {
|
|||
});
|
||||
}
|
||||
|
||||
main();
|
||||
window.addEventListener("load", main);
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -600,7 +624,9 @@ main();
|
|||
Intialiser les étudiants comme :
|
||||
<select name="etatDef" id="etatDef">
|
||||
<option value="">-</option>
|
||||
{% if not non_present %}
|
||||
<option value="present">présents</option>
|
||||
{% endif %}
|
||||
<option value="retard">en retard</option>
|
||||
<option value="absent">absents</option>
|
||||
</select>
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
const readOnly = {{ readonly }};
|
||||
|
||||
window.forceModule = "{{ forcer_module }}" == "True"
|
||||
window.nonPresent = {{ 'true' if non_present else 'false' }};
|
||||
|
||||
const etudsDefDem = {{ defdem | safe }}
|
||||
|
||||
|
@ -159,8 +160,10 @@
|
|||
<div class="mass-selection">
|
||||
<span>Mettre tout le monde :</span>
|
||||
<fieldset class="btns_field mass">
|
||||
{% if not non_present %}
|
||||
<input type="checkbox" value="present" name="mass_btn_assiduites" id="mass_rbtn_present"
|
||||
class="rbtn present" onclick="mettreToutLeMonde('present', this)" title="Present">
|
||||
{% endif %}
|
||||
<input type="checkbox" value="retard" name="mass_btn_assiduites" id="mass_rbtn_retard"
|
||||
class="rbtn retard" onclick="mettreToutLeMonde('retard', this)" title="Retard">
|
||||
<input type="checkbox" value="absent" name="mass_btn_assiduites" id="mass_rbtn_absent"
|
||||
|
@ -178,6 +181,11 @@
|
|||
</p>
|
||||
</div>
|
||||
|
||||
<div class="help">
|
||||
<h3>Calendrier</h3>
|
||||
{% include "assiduites/widgets/legende_couleur.j2" %}
|
||||
</div>
|
||||
|
||||
{% include "assiduites/widgets/toast.j2" %}
|
||||
{% include "assiduites/widgets/alert.j2" %}
|
||||
{% include "assiduites/widgets/prompt.j2" %}
|
||||
|
|
|
@ -1,12 +1,28 @@
|
|||
<li><span title="Vert" class="present demo"></span> → présence de l'étudiant lors de la période
|
||||
</li>
|
||||
<li><span title="Orange" class="retard demo"></span> → retard de l'étudiant lors de la période
|
||||
</li>
|
||||
<li><span title="Rouge" class="absent demo"></span> → absence de l'étudiant lors de la période
|
||||
</li>
|
||||
<p>Code couleur</p>
|
||||
<ul class="couleurs">
|
||||
<li><span title="Vert" class="present demo"></span> → présence de l'étudiant lors de la
|
||||
période
|
||||
</li>
|
||||
<li><span title="Bleu clair" class="nonwork demo"></span> → la période n'est pas travaillée
|
||||
</li>
|
||||
<li><span title="Rouge" class="absent demo"></span> → absence de l'étudiant lors de la
|
||||
période
|
||||
</li>
|
||||
<li><span title="Rose" class="demo color absent est_just"></span> → absence justifiée
|
||||
</li>
|
||||
<li><span title="Orange" class="retard demo"></span> → retard de l'étudiant lors de la
|
||||
période
|
||||
</li>
|
||||
<li><span title="Jaune clair" class="demo color retard est_just"></span> → retard justifié
|
||||
</li>
|
||||
|
||||
<li><span title="Hachure Bleue" class="justified demo"></span> → l'assiduité est justifiée par un
|
||||
justificatif valide</li>
|
||||
<li><span title="Hachure Rouge" class="invalid_justified demo"></span> → l'assiduité est
|
||||
justifiée par un justificatif non valide / en attente de validation
|
||||
</li>
|
||||
<li><span title="Quart Bleu" class="est_just demo color"></span> → la période est couverte par un
|
||||
justificatif valide</li>
|
||||
<li><span title="Justif. non valide" class="invalide demo color "></span> → la période est
|
||||
couverte par un justificatif non valide
|
||||
</li>
|
||||
<li><span title="Justif. en attente" class="attente demo color"></span> → la période
|
||||
a un justificatif en attente de validation
|
||||
</li>
|
||||
</ul>
|
||||
<p>Vous pouvez passer le curseur sur les jours colorés afin de voir les informations supplémentaires</p>
|
||||
|
|
|
@ -74,7 +74,13 @@
|
|||
setupAssiduiteBubble(block, assiduité);
|
||||
}
|
||||
|
||||
// TODO: ajout couleur justificatif
|
||||
// ajout couleur justificatif
|
||||
const justificatifs = assiduité.justificatifs || [];
|
||||
const justified = justificatifs.some(
|
||||
(justificatif) => justificatif.etat === "VALIDE"
|
||||
)
|
||||
|
||||
if(justified) block.classList.add("est_just");
|
||||
|
||||
block.classList.add(assiduité.etat.toLowerCase());
|
||||
if(assiduité.etat != "CRENEAU") block.classList.add("color");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<h2>Accès non autorisé</h2>
|
||||
|
||||
{{ exc | safe }}
|
||||
{{ exc }}
|
||||
|
||||
<p class="footer">
|
||||
{% if g.scodoc_dept %}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<h2>Erreur !</h2>
|
||||
|
||||
{{ exc | safe }}
|
||||
{{ exc }}
|
||||
|
||||
<div style="margin-top: 16px;">
|
||||
{% if g.scodoc_dept %}
|
||||
|
|
|
@ -1132,6 +1132,11 @@ def signal_assiduites_group():
|
|||
formsemestre_id=formsemestre_id,
|
||||
dept_id=g.scodoc_dept_id,
|
||||
),
|
||||
non_present=sco_preferences.get_preference(
|
||||
"non_present",
|
||||
formsemestre_id=formsemestre_id,
|
||||
dept_id=g.scodoc_dept_id,
|
||||
),
|
||||
formsemestre_date_debut=str(formsemestre.date_debut),
|
||||
formsemestre_date_fin=str(formsemestre.date_fin),
|
||||
formsemestre_id=formsemestre_id,
|
||||
|
@ -1914,8 +1919,29 @@ def _preparer_objet(
|
|||
@scodoc
|
||||
@permission_required(Permission.AbsChange)
|
||||
def signal_assiduites_diff():
|
||||
"""TODO documenter
|
||||
"""
|
||||
Utilisé notamment par "Saisie différée" sur tableau de bord semetstre"
|
||||
|
||||
Arguments de la requête:
|
||||
|
||||
- group_ids : liste des groupes
|
||||
example : group_ids=1,2,3
|
||||
- formsemestre_id : id du formsemestre
|
||||
example : formsemestre_id=1
|
||||
- moduleimpl_id : id du moduleimpl
|
||||
example : moduleimpl_id=1
|
||||
|
||||
(Permet de pré-générer une plage. Si non renseigné, la plage sera vide)
|
||||
(Les trois valeurs suivantes doivent être renseignées ensemble)
|
||||
- date
|
||||
example : date=01/01/2021
|
||||
- heure_debut
|
||||
example : heure_debut=08:00
|
||||
- heure_fin
|
||||
example : heure_fin=10:00
|
||||
|
||||
Exemple de requête :
|
||||
signal_assiduites_diff?formsemestre_id=67&group_ids=400&moduleimpl_id=1229&date=15/04/2024&heure_debut=12:34&heure_fin=12:55
|
||||
"""
|
||||
# Récupération des paramètres de la requête
|
||||
group_ids: list[int] = request.args.get("group_ids", None)
|
||||
|
@ -1957,11 +1983,23 @@ def signal_assiduites_diff():
|
|||
grp + ' <span class="fontred">' + groups_infos.groups_titles + "</span>"
|
||||
)
|
||||
|
||||
# Pré-remplissage des sélecteurs
|
||||
moduleimpl_id = request.args.get("moduleimpl_id", -1)
|
||||
try:
|
||||
moduleimpl_id = int(moduleimpl_id)
|
||||
except ValueError:
|
||||
moduleimpl_id = -1
|
||||
# date fra (dd/mm/yyyy)
|
||||
date = request.args.get("date", "")
|
||||
# heures (hh:mm)
|
||||
heure_deb = request.args.get("heure_debut", "")
|
||||
heure_fin = request.args.get("heure_fin", "")
|
||||
|
||||
# vérifications des sélecteurs
|
||||
date = date if re.match(r"^\d{2}\/\d{2}\/\d{4}$", date) else ""
|
||||
heure_deb = heure_deb if re.match(r"^[0-2]\d:[0-5]\d$", heure_deb) else ""
|
||||
heure_fin = heure_fin if re.match(r"^[0-2]\d:[0-5]\d$", heure_fin) else ""
|
||||
nouv_plage: list[str] = [date, heure_deb, heure_fin]
|
||||
|
||||
return render_template(
|
||||
"assiduites/pages/signal_assiduites_diff.j2",
|
||||
|
@ -1977,6 +2015,12 @@ def signal_assiduites_diff():
|
|||
formsemestre_id=formsemestre_id,
|
||||
dept_id=g.scodoc_dept_id,
|
||||
),
|
||||
non_present=sco_preferences.get_preference(
|
||||
"non_present",
|
||||
formsemestre_id=formsemestre_id,
|
||||
dept_id=g.scodoc_dept_id,
|
||||
),
|
||||
nouv_plage=nouv_plage,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.6.962"
|
||||
SCOVERSION = "9.6.964"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ mkdir -p "$optdir" || die "mkdir failure for $optdir"
|
|||
archive="$FACTORY_DIR"/"$PACKAGE_NAME-$RELEASE_TAG".tar.gz
|
||||
echo "Downloading $GIT_RELEASE_URL ..."
|
||||
# curl -o "$archive" "$GIT_RELEASE_URL" || die "curl failure for $GIT_RELEASE_URL"
|
||||
#wget --progress=dot -O "$archive" "$GIT_RELEASE_URL" || die "wget failure for $GIT_RELEASE_URL"
|
||||
wget --progress=dot -O "$archive" "$GIT_RELEASE_URL" || die "wget failure for $GIT_RELEASE_URL"
|
||||
# -nv
|
||||
|
||||
# On décomprime
|
||||
|
|
Loading…
Reference in New Issue