forked from ScoDoc/ScoDoc
Infos pour bulletins BUT pdf
This commit is contained in:
parent
ec9cdfe50a
commit
c923a5015b
@ -16,7 +16,7 @@ from app.scodoc import sco_bulletins, sco_utils as scu
|
|||||||
from app.scodoc import sco_bulletins_json
|
from app.scodoc import sco_bulletins_json
|
||||||
from app.scodoc import sco_bulletins_pdf
|
from app.scodoc import sco_bulletins_pdf
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc.sco_codes_parcours import UE_SPORT
|
from app.scodoc.sco_codes_parcours import UE_SPORT, DEF
|
||||||
from app.scodoc.sco_utils import fmt_note
|
from app.scodoc.sco_utils import fmt_note
|
||||||
|
|
||||||
|
|
||||||
@ -318,19 +318,42 @@ class BulletinBUT:
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
def bulletin_etud_complet(self, etud: Identite) -> dict:
|
def bulletin_etud_complet(self, etud: Identite) -> dict:
|
||||||
"""Bulletin dict complet avec toutes les infos pour les bulletins pdf"""
|
"""Bulletin dict complet avec toutes les infos pour les bulletins BUT pdf
|
||||||
|
Résultat compatible avec celui de sco_bulletins.formsemestre_bulletinetud_dict
|
||||||
|
"""
|
||||||
d = self.bulletin_etud(etud, self.res.formsemestre, force_publishing=True)
|
d = self.bulletin_etud(etud, self.res.formsemestre, force_publishing=True)
|
||||||
d["etudid"] = etud.id
|
d["etudid"] = etud.id
|
||||||
d["etud"] = d["etudiant"]
|
d["etud"] = d["etudiant"]
|
||||||
d["etud"]["nomprenom"] = etud.nomprenom
|
d["etud"]["nomprenom"] = etud.nomprenom
|
||||||
d.update(self.res.sem)
|
d.update(self.res.sem)
|
||||||
|
etud_etat = self.res.get_etud_etat(etud.id)
|
||||||
d["filigranne"] = sco_bulletins_pdf.get_filigranne(
|
d["filigranne"] = sco_bulletins_pdf.get_filigranne(
|
||||||
self.res.get_etud_etat(etud.id),
|
etud_etat,
|
||||||
self.prefs,
|
self.prefs,
|
||||||
decision_sem=d["semestre"].get("decision_sem"),
|
decision_sem=d["semestre"].get("decision_sem"),
|
||||||
)
|
)
|
||||||
|
if etud_etat == scu.DEMISSION:
|
||||||
|
d["demission"] = "(Démission)"
|
||||||
|
elif etud_etat == DEF:
|
||||||
|
d["demission"] = "(Défaillant)"
|
||||||
|
else:
|
||||||
|
d["demission"] = ""
|
||||||
|
|
||||||
# --- Absences
|
# --- Absences
|
||||||
d["nbabs"], d["nbabsjust"] = self.res.formsemestre.get_abs_count(etud.id)
|
d["nbabs"], d["nbabsjust"] = self.res.formsemestre.get_abs_count(etud.id)
|
||||||
|
|
||||||
|
# --- Decision Jury
|
||||||
|
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
|
||||||
|
etud.id,
|
||||||
|
self.res.formsemestre.id,
|
||||||
|
format="html",
|
||||||
|
show_date_inscr=self.prefs["bul_show_date_inscr"],
|
||||||
|
show_decisions=self.prefs["bul_show_decision"],
|
||||||
|
show_uevalid=self.prefs["bul_show_uevalid"],
|
||||||
|
show_mention=self.prefs["bul_show_mention"],
|
||||||
|
)
|
||||||
|
|
||||||
|
d.update(infos)
|
||||||
# --- Rangs
|
# --- Rangs
|
||||||
d[
|
d[
|
||||||
"rang_nt"
|
"rang_nt"
|
||||||
@ -341,5 +364,6 @@ class BulletinBUT:
|
|||||||
d.update(
|
d.update(
|
||||||
sco_bulletins.get_appreciations_list(self.res.formsemestre.id, etud.id)
|
sco_bulletins.get_appreciations_list(self.res.formsemestre.id, etud.id)
|
||||||
)
|
)
|
||||||
# XXX TODO A COMPLETER ?
|
d.update(sco_bulletins.make_context_dict(self.res.formsemestre, d["etud"]))
|
||||||
|
|
||||||
return d
|
return d
|
||||||
|
@ -35,6 +35,7 @@ import datetime
|
|||||||
|
|
||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
from flask_mail import Message
|
from flask_mail import Message
|
||||||
|
from app.models.formsemestre import FormSemestre
|
||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
@ -55,27 +56,30 @@ def abs_notify(etudid, date):
|
|||||||
"""
|
"""
|
||||||
from app.scodoc import sco_abs
|
from app.scodoc import sco_abs
|
||||||
|
|
||||||
sem = retreive_current_formsemestre(etudid, date)
|
formsemestre = retreive_current_formsemestre(etudid, date)
|
||||||
if not sem:
|
if not formsemestre:
|
||||||
return # non inscrit a la date, pas de notification
|
return # non inscrit a la date, pas de notification
|
||||||
|
|
||||||
nbabs, nbabsjust = sco_abs.get_abs_count(etudid, sem)
|
nbabs, nbabsjust = sco_abs.get_abs_count_in_interval(
|
||||||
do_abs_notify(sem, etudid, date, nbabs, nbabsjust)
|
etudid, formsemestre.date_debut.isoformat(), formsemestre.date_fin.isoformat()
|
||||||
|
)
|
||||||
|
do_abs_notify(formsemestre, etudid, date, nbabs, nbabsjust)
|
||||||
|
|
||||||
|
|
||||||
def do_abs_notify(sem, etudid, date, nbabs, nbabsjust):
|
def do_abs_notify(formsemestre: FormSemestre, etudid, date, nbabs, nbabsjust):
|
||||||
"""Given new counts of absences, check if notifications are requested and send them."""
|
"""Given new counts of absences, check if notifications are requested and send them."""
|
||||||
# prefs fallback to global pref if sem is None:
|
# prefs fallback to global pref if sem is None:
|
||||||
if sem:
|
if formsemestre:
|
||||||
formsemestre_id = sem["formsemestre_id"]
|
formsemestre_id = formsemestre.id
|
||||||
else:
|
else:
|
||||||
formsemestre_id = None
|
formsemestre_id = None
|
||||||
prefs = sco_preferences.SemPreferences(formsemestre_id=sem["formsemestre_id"])
|
prefs = sco_preferences.SemPreferences(formsemestre_id=formsemestre_id)
|
||||||
|
|
||||||
destinations = abs_notify_get_destinations(
|
destinations = abs_notify_get_destinations(
|
||||||
sem, prefs, etudid, date, nbabs, nbabsjust
|
formsemestre, prefs, etudid, date, nbabs, nbabsjust
|
||||||
)
|
)
|
||||||
msg = abs_notification_message(sem, prefs, etudid, nbabs, nbabsjust)
|
|
||||||
|
msg = abs_notification_message(formsemestre, prefs, etudid, nbabs, nbabsjust)
|
||||||
if not msg:
|
if not msg:
|
||||||
return # abort
|
return # abort
|
||||||
|
|
||||||
@ -131,19 +135,19 @@ def abs_notify_send(destinations, etudid, msg, nbabs, nbabsjust, formsemestre_id
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def abs_notify_get_destinations(sem, prefs, etudid, date, nbabs, nbabsjust):
|
def abs_notify_get_destinations(
|
||||||
|
formsemestre: FormSemestre, prefs, etudid, date, nbabs, nbabsjust
|
||||||
|
) -> set:
|
||||||
"""Returns set of destination emails to be notified"""
|
"""Returns set of destination emails to be notified"""
|
||||||
formsemestre_id = sem["formsemestre_id"]
|
|
||||||
|
|
||||||
destinations = [] # list of email address to notify
|
destinations = [] # list of email address to notify
|
||||||
|
|
||||||
if abs_notify_is_above_threshold(etudid, nbabs, nbabsjust, formsemestre_id):
|
if abs_notify_is_above_threshold(etudid, nbabs, nbabsjust, formsemestre.id):
|
||||||
if sem and prefs["abs_notify_respsem"]:
|
if prefs["abs_notify_respsem"]:
|
||||||
# notifie chaque responsable du semestre
|
# notifie chaque responsable du semestre
|
||||||
for responsable_id in sem["responsables"]:
|
for responsable in formsemestre.responsables:
|
||||||
u = sco_users.user_info(responsable_id)
|
if responsable.email:
|
||||||
if u["email"]:
|
destinations.append(responsable.email)
|
||||||
destinations.append(u["email"])
|
|
||||||
if prefs["abs_notify_chief"] and prefs["email_chefdpt"]:
|
if prefs["abs_notify_chief"] and prefs["email_chefdpt"]:
|
||||||
destinations.append(prefs["email_chefdpt"])
|
destinations.append(prefs["email_chefdpt"])
|
||||||
if prefs["abs_notify_email"]:
|
if prefs["abs_notify_email"]:
|
||||||
@ -156,7 +160,7 @@ def abs_notify_get_destinations(sem, prefs, etudid, date, nbabs, nbabsjust):
|
|||||||
# Notification (à chaque fois) des resp. de modules ayant des évaluations
|
# Notification (à chaque fois) des resp. de modules ayant des évaluations
|
||||||
# à cette date
|
# à cette date
|
||||||
# nb: on pourrait prevoir d'utiliser un autre format de message pour ce cas
|
# nb: on pourrait prevoir d'utiliser un autre format de message pour ce cas
|
||||||
if sem and prefs["abs_notify_respeval"]:
|
if prefs["abs_notify_respeval"]:
|
||||||
mods = mod_with_evals_at_date(date, etudid)
|
mods = mod_with_evals_at_date(date, etudid)
|
||||||
for mod in mods:
|
for mod in mods:
|
||||||
u = sco_users.user_info(mod["responsable_id"])
|
u = sco_users.user_info(mod["responsable_id"])
|
||||||
@ -232,7 +236,9 @@ def user_nbdays_since_last_notif(email_addr, etudid):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def abs_notification_message(sem, prefs, etudid, nbabs, nbabsjust):
|
def abs_notification_message(
|
||||||
|
formsemestre: FormSemestre, prefs, etudid, nbabs, nbabsjust
|
||||||
|
):
|
||||||
"""Mime notification message based on template.
|
"""Mime notification message based on template.
|
||||||
returns a Message instance
|
returns a Message instance
|
||||||
or None if sending should be canceled (empty template).
|
or None if sending should be canceled (empty template).
|
||||||
@ -242,7 +248,7 @@ def abs_notification_message(sem, prefs, etudid, nbabs, nbabsjust):
|
|||||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||||
|
|
||||||
# Variables accessibles dans les balises du template: %(nom_variable)s :
|
# Variables accessibles dans les balises du template: %(nom_variable)s :
|
||||||
values = sco_bulletins.make_context_dict(sem, etud)
|
values = sco_bulletins.make_context_dict(formsemestre, etud)
|
||||||
|
|
||||||
values["nbabs"] = nbabs
|
values["nbabs"] = nbabs
|
||||||
values["nbabsjust"] = nbabsjust
|
values["nbabsjust"] = nbabsjust
|
||||||
@ -264,9 +270,11 @@ def abs_notification_message(sem, prefs, etudid, nbabs, nbabsjust):
|
|||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
||||||
def retreive_current_formsemestre(etudid, cur_date):
|
def retreive_current_formsemestre(etudid: int, cur_date) -> FormSemestre:
|
||||||
"""Get formsemestre dans lequel etudid est (ou était) inscrit a la date indiquée
|
"""Get formsemestre dans lequel etudid est (ou était) inscrit a la date indiquée
|
||||||
date est une chaine au format ISO (yyyy-mm-dd)
|
date est une chaine au format ISO (yyyy-mm-dd)
|
||||||
|
|
||||||
|
Result: FormSemestre ou None si pas inscrit à la date indiquée
|
||||||
"""
|
"""
|
||||||
req = """SELECT i.formsemestre_id
|
req = """SELECT i.formsemestre_id
|
||||||
FROM notes_formsemestre_inscription i, notes_formsemestre sem
|
FROM notes_formsemestre_inscription i, notes_formsemestre sem
|
||||||
@ -278,8 +286,8 @@ def retreive_current_formsemestre(etudid, cur_date):
|
|||||||
if not r:
|
if not r:
|
||||||
return None
|
return None
|
||||||
# s'il y a plusieurs semestres, prend le premier (rarissime et non significatif):
|
# s'il y a plusieurs semestres, prend le premier (rarissime et non significatif):
|
||||||
sem = sco_formsemestre.get_formsemestre(r[0]["formsemestre_id"])
|
formsemestre = FormSemestre.query.get(r[0]["formsemestre_id"])
|
||||||
return sem
|
return formsemestre
|
||||||
|
|
||||||
|
|
||||||
def mod_with_evals_at_date(date_abs, etudid):
|
def mod_with_evals_at_date(date_abs, etudid):
|
||||||
|
@ -78,33 +78,20 @@ from app.scodoc import sco_bulletins_legacy
|
|||||||
from app.scodoc import sco_bulletins_ucac # format expérimental UCAC Cameroun
|
from app.scodoc import sco_bulletins_ucac # format expérimental UCAC Cameroun
|
||||||
|
|
||||||
|
|
||||||
def make_context_dict(sem, etud):
|
def make_context_dict(formsemestre: FormSemestre, etud: dict) -> dict:
|
||||||
"""Construit dictionnaire avec valeurs pour substitution des textes
|
"""Construit dictionnaire avec valeurs pour substitution des textes
|
||||||
(preferences bul_pdf_*)
|
(preferences bul_pdf_*)
|
||||||
"""
|
"""
|
||||||
C = sem.copy()
|
C = formsemestre.get_infos_dict()
|
||||||
C["responsable"] = " ,".join(
|
C["responsable"] = formsemestre.responsables_str()
|
||||||
[
|
C["anneesem"] = C["annee"] # backward compat
|
||||||
sco_users.user_info(responsable_id)["prenomnom"]
|
|
||||||
for responsable_id in sem["responsables"]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
annee_debut = sem["date_debut"].split("/")[2]
|
|
||||||
annee_fin = sem["date_fin"].split("/")[2]
|
|
||||||
if annee_debut != annee_fin:
|
|
||||||
annee = "%s - %s" % (annee_debut, annee_fin)
|
|
||||||
else:
|
|
||||||
annee = annee_debut
|
|
||||||
C["anneesem"] = annee
|
|
||||||
C.update(etud)
|
C.update(etud)
|
||||||
# copie preferences
|
# copie preferences
|
||||||
# XXX devrait acceder directement à un dict de preferences, à revoir
|
|
||||||
for name in sco_preferences.get_base_preferences().prefs_name:
|
for name in sco_preferences.get_base_preferences().prefs_name:
|
||||||
C[name] = sco_preferences.get_preference(name, sem["formsemestre_id"])
|
C[name] = sco_preferences.get_preference(name, formsemestre.id)
|
||||||
|
|
||||||
# ajoute groupes et group_0, group_1, ...
|
# ajoute groupes et group_0, group_1, ...
|
||||||
sco_groups.etud_add_group_infos(etud, sem)
|
sco_groups.etud_add_group_infos(etud, formsemestre.id)
|
||||||
C["groupes"] = etud["groupes"]
|
C["groupes"] = etud["groupes"]
|
||||||
n = 0
|
n = 0
|
||||||
for partition_id in etud["partitions"]:
|
for partition_id in etud["partitions"]:
|
||||||
@ -125,7 +112,8 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
|||||||
Le contenu du dictionnaire dépend des options (rangs, ...)
|
Le contenu du dictionnaire dépend des options (rangs, ...)
|
||||||
et de la version choisie (short, long, selectedevals).
|
et de la version choisie (short, long, selectedevals).
|
||||||
|
|
||||||
Cette fonction est utilisée pour les bulletins HTML et PDF, mais pas ceux en XML.
|
Cette fonction est utilisée pour les bulletins CLASSIQUES (DUT, ...)
|
||||||
|
en HTML et PDF, mais pas ceux en XML.
|
||||||
"""
|
"""
|
||||||
from app.scodoc import sco_abs
|
from app.scodoc import sco_abs
|
||||||
|
|
||||||
@ -190,7 +178,7 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
|||||||
)
|
)
|
||||||
I["etud_etat"] = nt.get_etud_etat(etudid)
|
I["etud_etat"] = nt.get_etud_etat(etudid)
|
||||||
I["filigranne"] = sco_bulletins_pdf.get_filigranne(
|
I["filigranne"] = sco_bulletins_pdf.get_filigranne(
|
||||||
I["etud_etat"], prefs, decision_dem=I["decision_sem"]
|
I["etud_etat"], prefs, decision_sem=I["decision_sem"]
|
||||||
)
|
)
|
||||||
I["demission"] = ""
|
I["demission"] = ""
|
||||||
if I["etud_etat"] == scu.DEMISSION:
|
if I["etud_etat"] == scu.DEMISSION:
|
||||||
@ -384,7 +372,7 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
|||||||
I["matieres_modules"].update(_sort_mod_by_matiere(modules, nt, etudid))
|
I["matieres_modules"].update(_sort_mod_by_matiere(modules, nt, etudid))
|
||||||
|
|
||||||
#
|
#
|
||||||
C = make_context_dict(I["sem"], I["etud"])
|
C = make_context_dict(formsemestre, I["etud"])
|
||||||
C.update(I)
|
C.update(I)
|
||||||
#
|
#
|
||||||
# log( 'C = \n%s\n' % pprint.pformat(C) ) # tres pratique pour voir toutes les infos dispo
|
# log( 'C = \n%s\n' % pprint.pformat(C) ) # tres pratique pour voir toutes les infos dispo
|
||||||
@ -842,7 +830,7 @@ def formsemestre_bulletinetud(
|
|||||||
|
|
||||||
H = [
|
H = [
|
||||||
_formsemestre_bulletinetud_header_html(
|
_formsemestre_bulletinetud_header_html(
|
||||||
etud, etudid, sem, formsemestre_id, format, version
|
etud, etudid, formsemestre, format, version
|
||||||
),
|
),
|
||||||
bulletin,
|
bulletin,
|
||||||
]
|
]
|
||||||
@ -1063,8 +1051,7 @@ def mail_bulletin(formsemestre_id, I, pdfdata, filename, recipient_addr):
|
|||||||
def _formsemestre_bulletinetud_header_html(
|
def _formsemestre_bulletinetud_header_html(
|
||||||
etud,
|
etud,
|
||||||
etudid,
|
etudid,
|
||||||
sem,
|
formsemestre: FormSemestre,
|
||||||
formsemestre_id=None,
|
|
||||||
format=None,
|
format=None,
|
||||||
version=None,
|
version=None,
|
||||||
):
|
):
|
||||||
@ -1078,33 +1065,27 @@ def _formsemestre_bulletinetud_header_html(
|
|||||||
],
|
],
|
||||||
cssstyles=["css/radar_bulletin.css"],
|
cssstyles=["css/radar_bulletin.css"],
|
||||||
),
|
),
|
||||||
"""<table class="bull_head"><tr><td>
|
f"""<table class="bull_head"><tr><td>
|
||||||
<h2><a class="discretelink" href="%s">%s</a></h2>
|
<h2><a class="discretelink" href="{
|
||||||
"""
|
|
||||||
% (
|
|
||||||
url_for(
|
url_for(
|
||||||
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
|
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
|
||||||
),
|
)}">{etud["nomprenom"]}</a></h2>
|
||||||
etud["nomprenom"],
|
|
||||||
),
|
<form name="f" method="GET" action="{request.base_url}">
|
||||||
"""
|
Bulletin <span class="bull_liensemestre"><a href="{
|
||||||
<form name="f" method="GET" action="%s">"""
|
url_for("notes.formsemestre_status",
|
||||||
% request.base_url,
|
scodoc_dept=g.scodoc_dept,
|
||||||
f"""Bulletin <span class="bull_liensemestre"><a href="{
|
formsemestre_id=formsemestre.id)}
|
||||||
url_for("notes.formsemestre_status",
|
">{formsemestre.titre_mois()}</a></span>
|
||||||
scodoc_dept=g.scodoc_dept,
|
<br/>
|
||||||
formsemestre_id=sem["formsemestre_id"])}
|
<table><tr>
|
||||||
">{sem["titremois"]}</a></span>
|
<td>établi le {time.strftime("%d/%m/%Y à %Hh%M")} (notes sur 20)</td>
|
||||||
<br/>"""
|
<td><span class="rightjust">
|
||||||
% sem,
|
<input type="hidden" name="formsemestre_id" value="{formsemestre.id}"></input>
|
||||||
"""<table><tr>""",
|
<input type="hidden" name="etudid" value="{etudid}"></input>
|
||||||
"""<td>établi le %s (notes sur 20)</td>""" % time.strftime("%d/%m/%Y à %Hh%M"),
|
<input type="hidden" name="format" value="{format}"></input>
|
||||||
"""<td><span class="rightjust">
|
<select name="version" onchange="document.f.submit()" class="noprint">
|
||||||
<input type="hidden" name="formsemestre_id" value="%s"></input>"""
|
""",
|
||||||
% formsemestre_id,
|
|
||||||
"""<input type="hidden" name="etudid" value="%s"></input>""" % etudid,
|
|
||||||
"""<input type="hidden" name="format" value="%s"></input>""" % format,
|
|
||||||
"""<select name="version" onchange="document.f.submit()" class="noprint">""",
|
|
||||||
]
|
]
|
||||||
for (v, e) in (
|
for (v, e) in (
|
||||||
("short", "Version courte"),
|
("short", "Version courte"),
|
||||||
@ -1125,7 +1106,7 @@ def _formsemestre_bulletinetud_header_html(
|
|||||||
"title": "Réglages bulletins",
|
"title": "Réglages bulletins",
|
||||||
"endpoint": "notes.formsemestre_edit_options",
|
"endpoint": "notes.formsemestre_edit_options",
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
# "target_url": url_for(
|
# "target_url": url_for(
|
||||||
# "notes.formsemestre_bulletinetud",
|
# "notes.formsemestre_bulletinetud",
|
||||||
# scodoc_dept=g.scodoc_dept,
|
# scodoc_dept=g.scodoc_dept,
|
||||||
@ -1133,17 +1114,16 @@ def _formsemestre_bulletinetud_header_html(
|
|||||||
# etudid=etudid,
|
# etudid=etudid,
|
||||||
# ),
|
# ),
|
||||||
},
|
},
|
||||||
"enabled": (current_user.id in sem["responsables"])
|
"enabled": formsemestre.can_be_edited_by(current_user),
|
||||||
or current_user.has_permission(Permission.ScoImplement),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": 'Version papier (pdf, format "%s")'
|
"title": 'Version papier (pdf, format "%s")'
|
||||||
% sco_bulletins_generator.bulletin_get_class_name_displayed(
|
% sco_bulletins_generator.bulletin_get_class_name_displayed(
|
||||||
formsemestre_id
|
formsemestre.id
|
||||||
),
|
),
|
||||||
"endpoint": endpoint,
|
"endpoint": endpoint,
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
"version": version,
|
"version": version,
|
||||||
"format": "pdf",
|
"format": "pdf",
|
||||||
@ -1153,19 +1133,19 @@ def _formsemestre_bulletinetud_header_html(
|
|||||||
"title": "Envoi par mail à %s" % etud["email"],
|
"title": "Envoi par mail à %s" % etud["email"],
|
||||||
"endpoint": endpoint,
|
"endpoint": endpoint,
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
"version": version,
|
"version": version,
|
||||||
"format": "pdfmail",
|
"format": "pdfmail",
|
||||||
},
|
},
|
||||||
# possible slt si on a un mail...
|
# possible slt si on a un mail...
|
||||||
"enabled": etud["email"] and can_send_bulletin_by_mail(formsemestre_id),
|
"enabled": etud["email"] and can_send_bulletin_by_mail(formsemestre.id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Envoi par mail à %s (adr. personnelle)" % etud["emailperso"],
|
"title": "Envoi par mail à %s (adr. personnelle)" % etud["emailperso"],
|
||||||
"endpoint": endpoint,
|
"endpoint": endpoint,
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
"version": version,
|
"version": version,
|
||||||
"format": "pdfmail",
|
"format": "pdfmail",
|
||||||
@ -1173,13 +1153,13 @@ def _formsemestre_bulletinetud_header_html(
|
|||||||
},
|
},
|
||||||
# possible slt si on a un mail...
|
# possible slt si on a un mail...
|
||||||
"enabled": etud["emailperso"]
|
"enabled": etud["emailperso"]
|
||||||
and can_send_bulletin_by_mail(formsemestre_id),
|
and can_send_bulletin_by_mail(formsemestre.id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Version json",
|
"title": "Version json",
|
||||||
"endpoint": endpoint,
|
"endpoint": endpoint,
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
"version": version,
|
"version": version,
|
||||||
"format": "json",
|
"format": "json",
|
||||||
@ -1189,7 +1169,7 @@ def _formsemestre_bulletinetud_header_html(
|
|||||||
"title": "Version XML",
|
"title": "Version XML",
|
||||||
"endpoint": endpoint,
|
"endpoint": endpoint,
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
"version": version,
|
"version": version,
|
||||||
"format": "xml",
|
"format": "xml",
|
||||||
@ -1199,19 +1179,19 @@ def _formsemestre_bulletinetud_header_html(
|
|||||||
"title": "Ajouter une appréciation",
|
"title": "Ajouter une appréciation",
|
||||||
"endpoint": "notes.appreciation_add_form",
|
"endpoint": "notes.appreciation_add_form",
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
},
|
},
|
||||||
"enabled": (
|
"enabled": (
|
||||||
(current_user.id in sem["responsables"])
|
formsemestre.can_be_edited_by(current_user)
|
||||||
or (current_user.has_permission(Permission.ScoEtudInscrit))
|
or current_user.has_permission(Permission.ScoEtudInscrit)
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Enregistrer un semestre effectué ailleurs",
|
"title": "Enregistrer un semestre effectué ailleurs",
|
||||||
"endpoint": "notes.formsemestre_ext_create_form",
|
"endpoint": "notes.formsemestre_ext_create_form",
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
},
|
},
|
||||||
"enabled": current_user.has_permission(Permission.ScoImplement),
|
"enabled": current_user.has_permission(Permission.ScoImplement),
|
||||||
@ -1220,34 +1200,34 @@ def _formsemestre_bulletinetud_header_html(
|
|||||||
"title": "Enregistrer une validation d'UE antérieure",
|
"title": "Enregistrer une validation d'UE antérieure",
|
||||||
"endpoint": "notes.formsemestre_validate_previous_ue",
|
"endpoint": "notes.formsemestre_validate_previous_ue",
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
},
|
},
|
||||||
"enabled": sco_permissions_check.can_validate_sem(formsemestre_id),
|
"enabled": sco_permissions_check.can_validate_sem(formsemestre.id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Enregistrer note d'une UE externe",
|
"title": "Enregistrer note d'une UE externe",
|
||||||
"endpoint": "notes.external_ue_create_form",
|
"endpoint": "notes.external_ue_create_form",
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
},
|
},
|
||||||
"enabled": sco_permissions_check.can_validate_sem(formsemestre_id),
|
"enabled": sco_permissions_check.can_validate_sem(formsemestre.id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Entrer décisions jury",
|
"title": "Entrer décisions jury",
|
||||||
"endpoint": "notes.formsemestre_validation_etud_form",
|
"endpoint": "notes.formsemestre_validation_etud_form",
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
},
|
},
|
||||||
"enabled": sco_permissions_check.can_validate_sem(formsemestre_id),
|
"enabled": sco_permissions_check.can_validate_sem(formsemestre.id),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Editer PV jury",
|
"title": "Editer PV jury",
|
||||||
"endpoint": "notes.formsemestre_pvjury_pdf",
|
"endpoint": "notes.formsemestre_pvjury_pdf",
|
||||||
"args": {
|
"args": {
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre.id,
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
},
|
},
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
@ -1263,7 +1243,7 @@ def _formsemestre_bulletinetud_header_html(
|
|||||||
url_for(
|
url_for(
|
||||||
"notes.formsemestre_bulletinetud",
|
"notes.formsemestre_bulletinetud",
|
||||||
scodoc_dept=g.scodoc_dept,
|
scodoc_dept=g.scodoc_dept,
|
||||||
formsemestre_id=formsemestre_id,
|
formsemestre_id=formsemestre.id,
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
format="pdf",
|
format="pdf",
|
||||||
version=version,
|
version=version,
|
||||||
|
@ -180,7 +180,9 @@ def search_etud_in_dept(expnom=""):
|
|||||||
e["_nomprenom_target"] = target
|
e["_nomprenom_target"] = target
|
||||||
e["inscription_target"] = target
|
e["inscription_target"] = target
|
||||||
e["_nomprenom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"])
|
e["_nomprenom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"])
|
||||||
sco_groups.etud_add_group_infos(e, e["cursem"])
|
sco_groups.etud_add_group_infos(
|
||||||
|
e, e["cursem"]["formsemestre_id"] if e["cursem"] else None
|
||||||
|
)
|
||||||
|
|
||||||
tab = GenTable(
|
tab = GenTable(
|
||||||
columns_ids=("nomprenom", "code_nip", "inscription", "groupes"),
|
columns_ids=("nomprenom", "code_nip", "inscription", "groupes"),
|
||||||
|
@ -321,7 +321,7 @@ def get_group_infos(group_id, etat=None): # was _getlisteetud
|
|||||||
t["etath"] = t["etat"]
|
t["etath"] = t["etat"]
|
||||||
# Add membership for all partitions, 'partition_id' : group
|
# Add membership for all partitions, 'partition_id' : group
|
||||||
for etud in members: # long: comment eviter ces boucles ?
|
for etud in members: # long: comment eviter ces boucles ?
|
||||||
etud_add_group_infos(etud, sem)
|
etud_add_group_infos(etud, sem["formsemestre_id"])
|
||||||
|
|
||||||
if group["group_name"] != None:
|
if group["group_name"] != None:
|
||||||
group_tit = "%s %s" % (group["partition_name"], group["group_name"])
|
group_tit = "%s %s" % (group["partition_name"], group["group_name"])
|
||||||
@ -413,12 +413,12 @@ def formsemestre_get_etud_groupnames(formsemestre_id, attr="group_name"):
|
|||||||
return R
|
return R
|
||||||
|
|
||||||
|
|
||||||
def etud_add_group_infos(etud, sem, sep=" "):
|
def etud_add_group_infos(etud, formsemestre_id, sep=" "):
|
||||||
"""Add informations on partitions and group memberships to etud (a dict with an etudid)"""
|
"""Add informations on partitions and group memberships to etud (a dict with an etudid)"""
|
||||||
etud[
|
etud[
|
||||||
"partitions"
|
"partitions"
|
||||||
] = collections.OrderedDict() # partition_id : group + partition_name
|
] = collections.OrderedDict() # partition_id : group + partition_name
|
||||||
if not sem:
|
if not formsemestre_id:
|
||||||
etud["groupes"] = ""
|
etud["groupes"] = ""
|
||||||
return etud
|
return etud
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ def etud_add_group_infos(etud, sem, sep=" "):
|
|||||||
and p.formsemestre_id = %(formsemestre_id)s
|
and p.formsemestre_id = %(formsemestre_id)s
|
||||||
ORDER BY p.numero
|
ORDER BY p.numero
|
||||||
""",
|
""",
|
||||||
{"etudid": etud["etudid"], "formsemestre_id": sem["formsemestre_id"]},
|
{"etudid": etud["etudid"], "formsemestre_id": formsemestre_id},
|
||||||
)
|
)
|
||||||
|
|
||||||
for info in infos:
|
for info in infos:
|
||||||
@ -439,13 +439,13 @@ def etud_add_group_infos(etud, sem, sep=" "):
|
|||||||
|
|
||||||
# resume textuel des groupes:
|
# resume textuel des groupes:
|
||||||
etud["groupes"] = sep.join(
|
etud["groupes"] = sep.join(
|
||||||
[g["group_name"] for g in infos if g["group_name"] != None]
|
[gr["group_name"] for gr in infos if gr["group_name"] is not None]
|
||||||
)
|
)
|
||||||
etud["partitionsgroupes"] = sep.join(
|
etud["partitionsgroupes"] = sep.join(
|
||||||
[
|
[
|
||||||
g["partition_name"] + ":" + g["group_name"]
|
gr["partition_name"] + ":" + gr["group_name"]
|
||||||
for g in infos
|
for gr in infos
|
||||||
if g["group_name"] != None
|
if gr["group_name"] is not None
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ def sco_import_generate_excel_sample(
|
|||||||
for field in titles:
|
for field in titles:
|
||||||
if field == "groupes":
|
if field == "groupes":
|
||||||
sco_groups.etud_add_group_infos(
|
sco_groups.etud_add_group_infos(
|
||||||
etud, groups_infos.formsemestre, sep=";"
|
etud, groups_infos.formsemestre_id, sep=";"
|
||||||
)
|
)
|
||||||
l.append(etud["partitionsgroupes"])
|
l.append(etud["partitionsgroupes"])
|
||||||
else:
|
else:
|
||||||
|
@ -196,7 +196,10 @@ def do_inscrit(sem, etudids, inscrit_groupes=False):
|
|||||||
if len(etud["sems"]) < 2:
|
if len(etud["sems"]) < 2:
|
||||||
continue
|
continue
|
||||||
prev_formsemestre = etud["sems"][1]
|
prev_formsemestre = etud["sems"][1]
|
||||||
sco_groups.etud_add_group_infos(etud, prev_formsemestre)
|
sco_groups.etud_add_group_infos(
|
||||||
|
etud,
|
||||||
|
prev_formsemestre["formsemestre_id"] if prev_formsemestre else None,
|
||||||
|
)
|
||||||
|
|
||||||
cursem_groups_by_name = dict(
|
cursem_groups_by_name = dict(
|
||||||
[
|
[
|
||||||
|
@ -215,7 +215,9 @@ def ficheEtud(etudid=None):
|
|||||||
info["modifadresse"] = ""
|
info["modifadresse"] = ""
|
||||||
|
|
||||||
# Groupes:
|
# Groupes:
|
||||||
sco_groups.etud_add_group_infos(info, info["cursem"])
|
sco_groups.etud_add_group_infos(
|
||||||
|
info, info["cursem"]["formsemestre_id"] if info["cursem"] else None
|
||||||
|
)
|
||||||
|
|
||||||
# Parcours de l'étudiant
|
# Parcours de l'étudiant
|
||||||
if info["sems"]:
|
if info["sems"]:
|
||||||
|
@ -513,7 +513,7 @@ def etud_info(etudid=None, format="xml"):
|
|||||||
|
|
||||||
sem = etud["cursem"]
|
sem = etud["cursem"]
|
||||||
if sem:
|
if sem:
|
||||||
sco_groups.etud_add_group_infos(etud, sem)
|
sco_groups.etud_add_group_infos(etud, sem["formsemestre_id"] if sem else None)
|
||||||
d["insemestre"] = [
|
d["insemestre"] = [
|
||||||
{
|
{
|
||||||
"current": "1",
|
"current": "1",
|
||||||
|
Loading…
Reference in New Issue
Block a user