2020-09-26 16:19:37 +02:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# Gestion scolarite IUT
|
|
|
|
#
|
2023-12-31 23:04:06 +01:00
|
|
|
# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved.
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
# Emmanuel Viennet emmanuel.viennet@viennet.net
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""Edition des PV de jury
|
|
|
|
|
2023-02-19 15:45:27 +01:00
|
|
|
Formulaires paramétrage PV et génération des tables
|
2020-09-26 16:19:37 +02:00
|
|
|
"""
|
2023-03-08 22:23:55 +01:00
|
|
|
import collections
|
2021-06-19 23:21:37 +02:00
|
|
|
import time
|
|
|
|
from reportlab.platypus import Paragraph
|
|
|
|
from reportlab.lib import styles
|
|
|
|
|
2021-08-01 10:16:16 +02:00
|
|
|
import flask
|
2022-07-03 08:31:01 +02:00
|
|
|
from flask import flash, redirect, url_for
|
|
|
|
from flask import g, request
|
2022-02-09 23:22:00 +01:00
|
|
|
|
2023-02-19 15:45:27 +01:00
|
|
|
from app.models import FormSemestre, Identite
|
2021-07-11 17:37:12 +02:00
|
|
|
|
2021-06-19 23:21:37 +02:00
|
|
|
import app.scodoc.sco_utils as scu
|
|
|
|
import app.scodoc.notesdb as ndb
|
|
|
|
from app.scodoc import html_sco_header
|
2023-02-12 13:36:47 +01:00
|
|
|
from app.scodoc import codes_cursus
|
2023-02-19 15:45:27 +01:00
|
|
|
from app.scodoc import sco_pv_dict
|
2022-07-07 16:24:52 +02:00
|
|
|
from app.scodoc import sco_etud
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import sco_groups
|
|
|
|
from app.scodoc import sco_groups_view
|
|
|
|
from app.scodoc import sco_pdf
|
|
|
|
from app.scodoc import sco_preferences
|
2023-02-19 15:45:27 +01:00
|
|
|
from app.scodoc import sco_pv_pdf
|
|
|
|
from app.scodoc import sco_pv_lettres_inviduelles
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.gen_tables import GenTable
|
2023-02-12 13:36:47 +01:00
|
|
|
from app.scodoc.codes_cursus import NO_SEMESTRE_ID
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.sco_pdf import PDFLOCK
|
|
|
|
from app.scodoc.TrivialFormulator import TrivialFormulator
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2021-08-21 00:24:51 +02:00
|
|
|
def _descr_decision_sem_abbrev(etat, decision_sem):
|
2020-09-26 16:19:37 +02:00
|
|
|
"résumé textuel tres court (code) de la décision de semestre"
|
|
|
|
if etat == "D":
|
|
|
|
decision = "Démission"
|
|
|
|
else:
|
|
|
|
if decision_sem:
|
|
|
|
decision = decision_sem["code"]
|
|
|
|
else:
|
|
|
|
decision = ""
|
|
|
|
return decision
|
|
|
|
|
|
|
|
|
|
|
|
def pvjury_table(
|
|
|
|
dpv,
|
|
|
|
only_diplome=False,
|
|
|
|
anonymous=False,
|
|
|
|
with_parcours_decisions=False,
|
|
|
|
with_paragraph_nom=False, # cellule paragraphe avec nom, date, code NIP
|
|
|
|
):
|
|
|
|
"""idem mais rend list de dicts
|
|
|
|
Si only_diplome, n'extrait que les etudiants qui valident leur diplome.
|
|
|
|
"""
|
|
|
|
sem = dpv["formsemestre"]
|
|
|
|
formsemestre_id = sem["formsemestre_id"]
|
|
|
|
sem_id_txt_sp = sem["sem_id_txt"]
|
|
|
|
if sem_id_txt_sp:
|
|
|
|
sem_id_txt_sp = " " + sem_id_txt_sp
|
|
|
|
titles = {
|
|
|
|
"etudid": "etudid",
|
|
|
|
"code_nip": "NIP",
|
|
|
|
"nomprenom": "Nom", # si with_paragraph_nom, sera un Paragraph
|
|
|
|
"parcours": "Parcours",
|
|
|
|
"decision": "Décision" + sem_id_txt_sp,
|
|
|
|
"mention": "Mention",
|
|
|
|
"ue_cap": "UE" + sem_id_txt_sp + " capitalisées",
|
|
|
|
"ects": "ECTS",
|
|
|
|
"devenir": "Devenir",
|
2020-10-13 16:01:38 +02:00
|
|
|
"validation_parcours_code": "Résultat au diplôme",
|
2020-09-26 16:19:37 +02:00
|
|
|
"observations": "Observations",
|
|
|
|
}
|
|
|
|
if anonymous:
|
|
|
|
titles["nomprenom"] = "Code"
|
|
|
|
columns_ids = ["nomprenom", "parcours"]
|
|
|
|
|
|
|
|
if with_parcours_decisions:
|
|
|
|
all_idx = set()
|
|
|
|
for e in dpv["decisions"]:
|
|
|
|
all_idx |= set(e["parcours_decisions"].keys())
|
|
|
|
sem_ids = sorted(all_idx)
|
|
|
|
for i in sem_ids:
|
|
|
|
if i != NO_SEMESTRE_ID:
|
|
|
|
titles[i] = "S%d" % i
|
|
|
|
else:
|
|
|
|
titles[i] = "S" # pas très parlant ?
|
|
|
|
columns_ids += [i]
|
|
|
|
|
|
|
|
if dpv["has_prev"]:
|
|
|
|
id_prev = sem["semestre_id"] - 1 # numero du semestre precedent
|
2023-02-19 02:54:29 +01:00
|
|
|
titles["prev_decision"] = f"Décision S{id_prev}"
|
2020-09-26 16:19:37 +02:00
|
|
|
columns_ids += ["prev_decision"]
|
|
|
|
|
2022-07-17 15:15:24 +02:00
|
|
|
if not dpv["is_apc"]:
|
|
|
|
# Décision de jury sur le semestre, sauf en BUT
|
|
|
|
columns_ids += ["decision"]
|
|
|
|
|
2021-07-28 17:03:54 +02:00
|
|
|
if sco_preferences.get_preference("bul_show_mention", formsemestre_id):
|
2020-09-26 16:19:37 +02:00
|
|
|
columns_ids += ["mention"]
|
|
|
|
columns_ids += ["ue_cap"]
|
2021-07-28 17:03:54 +02:00
|
|
|
if sco_preferences.get_preference("bul_show_ects", formsemestre_id):
|
2020-09-26 16:19:37 +02:00
|
|
|
columns_ids += ["ects"]
|
2020-10-13 16:01:38 +02:00
|
|
|
|
2021-02-13 19:20:21 +01:00
|
|
|
# XXX if not dpv["semestre_non_terminal"]:
|
|
|
|
# La colonne doit être présente: redoublants validant leur diplome
|
|
|
|
# en répétant un semestre ancien: exemple: S1 (ADM), S2 (ADM), S3 (AJ), S4 (ADM), S3 (ADM)=> diplôme
|
|
|
|
columns_ids += ["validation_parcours_code"]
|
|
|
|
columns_ids += ["devenir"]
|
2020-09-26 16:19:37 +02:00
|
|
|
columns_ids += ["observations"]
|
|
|
|
|
|
|
|
lines = []
|
|
|
|
for e in dpv["decisions"]:
|
2021-06-19 23:21:37 +02:00
|
|
|
sco_etud.format_etud_ident(e["identite"])
|
2020-09-26 16:19:37 +02:00
|
|
|
l = {
|
|
|
|
"etudid": e["identite"]["etudid"],
|
|
|
|
"code_nip": e["identite"]["code_nip"],
|
|
|
|
"nomprenom": e["identite"]["nomprenom"],
|
2021-07-11 17:37:12 +02:00
|
|
|
"_nomprenom_target": url_for(
|
2024-01-20 14:49:36 +01:00
|
|
|
"scolar.fiche_etud",
|
2021-07-11 17:37:12 +02:00
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
etudid=e["identite"]["etudid"],
|
|
|
|
),
|
2022-07-17 15:15:24 +02:00
|
|
|
"_nomprenom_td_attrs": f"""id="{e['identite']['etudid']}" class="etudinfo" """,
|
2020-09-26 16:19:37 +02:00
|
|
|
"parcours": e["parcours"],
|
2021-08-21 00:24:51 +02:00
|
|
|
"decision": _descr_decision_sem_abbrev(e["etat"], e["decision_sem"]),
|
2020-09-26 16:19:37 +02:00
|
|
|
"ue_cap": e["decisions_ue_descr"],
|
2021-02-13 19:20:21 +01:00
|
|
|
"validation_parcours_code": "ADM" if e["validation_parcours"] else "",
|
2020-09-26 16:19:37 +02:00
|
|
|
"devenir": e["autorisations_descr"],
|
2021-02-03 22:00:41 +01:00
|
|
|
"observations": ndb.unquote(e["observation"]),
|
2020-09-26 16:19:37 +02:00
|
|
|
"mention": e["mention"],
|
|
|
|
"ects": str(e["sum_ects"]),
|
|
|
|
}
|
|
|
|
if with_paragraph_nom:
|
|
|
|
cell_style = styles.ParagraphStyle({})
|
2021-06-13 23:37:14 +02:00
|
|
|
cell_style.fontSize = sco_preferences.get_preference(
|
2021-07-28 17:03:54 +02:00
|
|
|
"SCOLAR_FONT_SIZE", formsemestre_id
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2021-06-13 23:37:14 +02:00
|
|
|
cell_style.fontName = sco_preferences.get_preference(
|
2021-07-28 17:03:54 +02:00
|
|
|
"PV_FONTNAME", formsemestre_id
|
2021-06-13 23:37:14 +02:00
|
|
|
)
|
|
|
|
cell_style.leading = 1.0 * sco_preferences.get_preference(
|
2021-07-28 17:03:54 +02:00
|
|
|
"SCOLAR_FONT_SIZE", formsemestre_id
|
2020-09-26 16:19:37 +02:00
|
|
|
) # vertical space
|
|
|
|
i = e["identite"]
|
|
|
|
l["nomprenom"] = [
|
2021-02-13 19:20:21 +01:00
|
|
|
Paragraph(sco_pdf.SU(i["nomprenom"]), cell_style),
|
|
|
|
Paragraph(sco_pdf.SU(i["code_nip"]), cell_style),
|
2020-09-26 16:19:37 +02:00
|
|
|
Paragraph(
|
2021-02-13 19:20:21 +01:00
|
|
|
sco_pdf.SU(
|
2020-09-26 16:19:37 +02:00
|
|
|
"Né le %s" % i["date_naissance"]
|
|
|
|
+ (" à %s" % i["lieu_naissance"] if i["lieu_naissance"] else "")
|
|
|
|
+ (" (%s)" % i["dept_naissance"] if i["dept_naissance"] else "")
|
|
|
|
),
|
|
|
|
cell_style,
|
|
|
|
),
|
|
|
|
]
|
|
|
|
if anonymous:
|
|
|
|
# Mode anonyme: affiche INE ou sinon NIP, ou id
|
|
|
|
l["nomprenom"] = (
|
|
|
|
e["identite"]["code_ine"]
|
|
|
|
or e["identite"]["code_nip"]
|
|
|
|
or e["identite"]["etudid"]
|
|
|
|
)
|
|
|
|
if with_parcours_decisions:
|
|
|
|
for i in e[
|
|
|
|
"parcours_decisions"
|
|
|
|
]: # or equivalently: l.update(e['parcours_decisions'])
|
|
|
|
l[i] = e["parcours_decisions"][i]
|
|
|
|
|
|
|
|
if e["validation_parcours"]:
|
|
|
|
l["devenir"] = "Diplôme obtenu"
|
|
|
|
if dpv["has_prev"]:
|
|
|
|
l["prev_decision"] = _descr_decision_sem_abbrev(
|
2021-08-21 00:24:51 +02:00
|
|
|
None, e["prev_decision_sem"]
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
if e["validation_parcours"] or not only_diplome:
|
|
|
|
lines.append(l)
|
|
|
|
return lines, titles, columns_ids
|
|
|
|
|
|
|
|
|
2023-09-21 10:20:19 +02:00
|
|
|
def formsemestre_pvjury(formsemestre_id, fmt="html", publish=True):
|
2023-02-21 02:43:26 +01:00
|
|
|
"""Page récapitulant les décisions de jury
|
|
|
|
En classique: table spécifique avec les deux semestres pour le DUT
|
|
|
|
En APC/BUT: renvoie vers table recap, en mode jury.
|
|
|
|
"""
|
2023-03-20 11:17:38 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2022-07-17 15:15:24 +02:00
|
|
|
is_apc = formsemestre.formation.is_apc()
|
2023-09-21 10:20:19 +02:00
|
|
|
if fmt == "html" and is_apc:
|
2023-02-12 01:13:43 +01:00
|
|
|
return redirect(
|
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_recapcomplet",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
mode_jury=1,
|
|
|
|
)
|
2022-06-25 17:18:05 +02:00
|
|
|
)
|
2023-02-12 01:13:43 +01:00
|
|
|
|
2021-07-29 10:19:00 +02:00
|
|
|
footer = html_sco_header.sco_footer()
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-02-19 15:45:27 +01:00
|
|
|
dpv = sco_pv_dict.dict_pvjury(formsemestre_id, with_prev=True)
|
2020-09-26 16:19:37 +02:00
|
|
|
if not dpv:
|
2023-09-21 10:20:19 +02:00
|
|
|
if fmt == "html":
|
2020-09-26 16:19:37 +02:00
|
|
|
return (
|
2021-07-29 16:31:15 +02:00
|
|
|
html_sco_header.sco_header()
|
2020-09-26 16:19:37 +02:00
|
|
|
+ "<h2>Aucune information disponible !</h2>"
|
|
|
|
+ footer
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
return None
|
|
|
|
sem = dpv["formsemestre"]
|
|
|
|
formsemestre_id = sem["formsemestre_id"]
|
|
|
|
|
2021-08-21 00:24:51 +02:00
|
|
|
rows, titles, columns_ids = pvjury_table(dpv)
|
2023-09-21 10:20:19 +02:00
|
|
|
if fmt != "html" and fmt != "pdf":
|
2020-09-26 16:19:37 +02:00
|
|
|
columns_ids = ["etudid", "code_nip"] + columns_ids
|
|
|
|
|
|
|
|
tab = GenTable(
|
|
|
|
rows=rows,
|
|
|
|
titles=titles,
|
|
|
|
columns_ids=columns_ids,
|
2021-02-04 20:02:44 +01:00
|
|
|
filename=scu.make_filename("decisions " + sem["titreannee"]),
|
2023-12-15 18:53:38 +01:00
|
|
|
origin=f"Généré par {scu.sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
2020-09-26 16:19:37 +02:00
|
|
|
caption="Décisions jury pour " + sem["titreannee"],
|
|
|
|
html_class="table_leftalign",
|
|
|
|
html_sortable=True,
|
2021-07-28 17:03:54 +02:00
|
|
|
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2023-09-21 10:20:19 +02:00
|
|
|
if fmt != "html":
|
2020-09-26 16:19:37 +02:00
|
|
|
return tab.make_page(
|
2023-09-21 10:20:19 +02:00
|
|
|
fmt=fmt,
|
2020-09-26 16:19:37 +02:00
|
|
|
with_html_headers=False,
|
|
|
|
publish=publish,
|
|
|
|
)
|
2021-09-18 10:10:02 +02:00
|
|
|
tab.base_url = "%s?formsemestre_id=%s" % (request.base_url, formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
H = [
|
2021-06-13 19:12:20 +02:00
|
|
|
html_sco_header.html_sem_header(
|
2020-09-26 16:19:37 +02:00
|
|
|
"Décisions du jury pour le semestre",
|
|
|
|
init_qtip=True,
|
|
|
|
javascripts=["js/etud_info.js"],
|
|
|
|
),
|
|
|
|
"""<p>(dernière modif le %s)</p>""" % dpv["date"],
|
|
|
|
]
|
|
|
|
|
|
|
|
H.append(
|
|
|
|
'<ul><li><a class="stdlink" href="formsemestre_lettres_individuelles?formsemestre_id=%s">Courriers individuels (classeur pdf)</a></li>'
|
|
|
|
% formsemestre_id
|
|
|
|
)
|
|
|
|
H.append(
|
|
|
|
'<li><a class="stdlink" href="formsemestre_pvjury_pdf?formsemestre_id=%s">PV officiel (pdf)</a></li></ul>'
|
|
|
|
% formsemestre_id
|
|
|
|
)
|
|
|
|
|
|
|
|
H.append(tab.html())
|
|
|
|
|
|
|
|
# Count number of cases for each decision
|
2023-03-08 22:23:55 +01:00
|
|
|
counts = collections.defaultdict(int)
|
2020-09-26 16:19:37 +02:00
|
|
|
for row in rows:
|
|
|
|
counts[row["decision"]] += 1
|
|
|
|
# add codes for previous (for explanation, without count)
|
2021-07-09 17:47:06 +02:00
|
|
|
if "prev_decision" in row and row["prev_decision"]:
|
2020-09-26 16:19:37 +02:00
|
|
|
counts[row["prev_decision"]] += 0
|
|
|
|
# Légende des codes
|
2022-01-22 12:15:03 +01:00
|
|
|
codes = list(counts.keys())
|
2020-09-26 16:19:37 +02:00
|
|
|
codes.sort()
|
2023-12-15 18:53:38 +01:00
|
|
|
|
|
|
|
H.append("""<div class="codes"><h3>Explication des codes</h3>""")
|
2020-09-26 16:19:37 +02:00
|
|
|
lines = []
|
|
|
|
for code in codes:
|
|
|
|
lines.append(
|
|
|
|
{
|
|
|
|
"code": code,
|
|
|
|
"count": counts[code],
|
2023-02-12 13:36:47 +01:00
|
|
|
"expl": codes_cursus.CODES_EXPL.get(code, ""),
|
2020-09-26 16:19:37 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
H.append(
|
|
|
|
GenTable(
|
|
|
|
rows=lines,
|
|
|
|
titles={"code": "Code", "count": "Nombre", "expl": ""},
|
|
|
|
columns_ids=("code", "count", "expl"),
|
2023-12-15 18:53:38 +01:00
|
|
|
html_class="table_leftalign codes-jury",
|
|
|
|
html_class_ignore_default=True, # pas une DataTable
|
2020-09-26 16:19:37 +02:00
|
|
|
html_sortable=True,
|
2023-12-15 18:53:38 +01:00
|
|
|
html_with_td_classes=True,
|
2021-07-28 17:03:54 +02:00
|
|
|
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
2020-09-26 16:19:37 +02:00
|
|
|
).html()
|
|
|
|
)
|
2023-12-15 18:53:38 +01:00
|
|
|
H.append(
|
|
|
|
"""<style>
|
|
|
|
div.codes {
|
|
|
|
margin-bottom: 12px;
|
|
|
|
}
|
|
|
|
table.codes-jury th, table.codes-jury td {
|
|
|
|
padding: 4px 8px 4px 8px;
|
|
|
|
}
|
|
|
|
table.codes-jury td {
|
|
|
|
background-color: #CCCCCC;
|
|
|
|
}
|
|
|
|
table.codes-jury td.count {
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
H.append("</div>") # /codes
|
2020-09-26 16:19:37 +02:00
|
|
|
return "\n".join(H) + footer
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2023-02-18 18:49:52 +01:00
|
|
|
def formsemestre_pvjury_pdf(formsemestre_id, group_ids: list[int] = None, etudid=None):
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Generation PV jury en PDF: saisie des paramètres
|
|
|
|
Si etudid, PV pour un seul etudiant. Sinon, tout les inscrits au groupe indiqué.
|
|
|
|
"""
|
2023-02-18 18:49:52 +01:00
|
|
|
group_ids = group_ids or []
|
2023-02-19 02:54:29 +01:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
2020-12-01 16:46:45 +01:00
|
|
|
# Mise à jour des groupes d'étapes:
|
2021-08-19 10:28:35 +02:00
|
|
|
sco_groups.create_etapes_partition(formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
groups_infos = None
|
|
|
|
if etudid:
|
|
|
|
# PV pour ce seul étudiant:
|
2023-03-20 11:17:38 +01:00
|
|
|
etud = Identite.get_etud(etudid)
|
2023-02-18 18:49:52 +01:00
|
|
|
etuddescr = f"""<a class="discretelink" href="{
|
2024-01-20 14:49:36 +01:00
|
|
|
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
2023-02-18 18:49:52 +01:00
|
|
|
}">{etud.nomprenom}</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
etudids = [etudid]
|
|
|
|
else:
|
|
|
|
etuddescr = ""
|
|
|
|
if not group_ids:
|
|
|
|
# tous les inscrits du semestre
|
2021-07-29 16:31:15 +02:00
|
|
|
group_ids = [sco_groups.get_default_group(formsemestre_id)]
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
groups_infos = sco_groups_view.DisplayedGroupsInfos(
|
2021-09-08 00:34:45 +02:00
|
|
|
group_ids, formsemestre_id=formsemestre_id
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
etudids = [m["etudid"] for m in groups_infos.members]
|
|
|
|
|
|
|
|
H = [
|
2021-06-13 19:12:20 +02:00
|
|
|
html_sco_header.html_sem_header(
|
2023-02-18 18:49:52 +01:00
|
|
|
f"Édition du PV de jury {etuddescr}",
|
2020-09-26 16:19:37 +02:00
|
|
|
javascripts=sco_groups_view.JAVASCRIPTS,
|
|
|
|
cssstyles=sco_groups_view.CSSSTYLES,
|
|
|
|
init_qtip=True,
|
|
|
|
),
|
2023-02-18 18:49:52 +01:00
|
|
|
f"""<div class="help">Utiliser cette page pour éditer des versions provisoires des PV.
|
|
|
|
<span class="fontred">Il est recommandé d'archiver les versions définitives:
|
|
|
|
<a class="stdlink" href="{url_for(
|
|
|
|
'notes.formsemestre_archive',
|
|
|
|
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre_id)
|
|
|
|
}">voir cette page</a></span>
|
|
|
|
</div>""",
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
|
|
|
F = [
|
2023-02-18 18:49:52 +01:00
|
|
|
"""<p><em>Voir aussi si besoin les réglages sur la page "Paramétrage"
|
|
|
|
(accessible à l'administrateur du département).</em>
|
2020-09-26 16:19:37 +02:00
|
|
|
</p>""",
|
2021-07-29 10:19:00 +02:00
|
|
|
html_sco_header.sco_footer(),
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
2023-02-19 02:54:29 +01:00
|
|
|
descr = descrform_pvjury(formsemestre)
|
2020-09-26 16:19:37 +02:00
|
|
|
if etudid:
|
|
|
|
descr.append(("etudid", {"input_type": "hidden"}))
|
|
|
|
|
|
|
|
if groups_infos:
|
|
|
|
menu_choix_groupe = (
|
|
|
|
"""<div class="group_ids_sel_menu">Groupes d'étudiants à lister sur le PV: """
|
2021-08-20 10:51:42 +02:00
|
|
|
+ sco_groups_view.menu_groups_choice(groups_infos)
|
2020-09-26 16:19:37 +02:00
|
|
|
+ """</div>"""
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
menu_choix_groupe = "" # un seul etudiant à editer
|
|
|
|
tf = TrivialFormulator(
|
2021-09-18 10:10:02 +02:00
|
|
|
request.base_url,
|
2021-09-27 16:42:14 +02:00
|
|
|
scu.get_request_args(),
|
2020-09-26 16:19:37 +02:00
|
|
|
descr,
|
|
|
|
cancelbutton="Annuler",
|
|
|
|
submitlabel="Générer document",
|
|
|
|
name="tf",
|
|
|
|
formid="group_selector",
|
|
|
|
html_foot_markup=menu_choix_groupe,
|
|
|
|
)
|
|
|
|
if tf[0] == 0:
|
|
|
|
return "\n".join(H) + "\n" + tf[1] + "\n".join(F)
|
|
|
|
elif tf[0] == -1:
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(
|
2023-02-18 18:49:52 +01:00
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_pvjury",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
# submit
|
2023-02-19 02:54:29 +01:00
|
|
|
tf[2]["show_title"] = bool(tf[2]["show_title"])
|
|
|
|
tf[2]["anonymous"] = bool(tf[2]["anonymous"])
|
2020-09-26 16:19:37 +02:00
|
|
|
try:
|
|
|
|
PDFLOCK.acquire()
|
2023-02-19 15:45:27 +01:00
|
|
|
pdfdoc = sco_pv_pdf.pvjury_pdf(
|
2023-02-19 02:54:29 +01:00
|
|
|
formsemestre,
|
|
|
|
etudids,
|
|
|
|
numero_arrete=tf[2]["numero_arrete"],
|
|
|
|
code_vdi=tf[2]["code_vdi"],
|
2020-09-26 16:19:37 +02:00
|
|
|
date_commission=tf[2]["date_commission"],
|
|
|
|
date_jury=tf[2]["date_jury"],
|
2023-02-19 02:54:29 +01:00
|
|
|
show_title=tf[2]["show_title"],
|
2023-10-18 15:55:51 +02:00
|
|
|
pv_title_session=tf[2]["pv_title_session"],
|
2020-12-01 11:03:20 +01:00
|
|
|
pv_title=tf[2]["pv_title"],
|
2020-09-26 16:19:37 +02:00
|
|
|
with_paragraph_nom=tf[2]["with_paragraph_nom"],
|
|
|
|
anonymous=tf[2]["anonymous"],
|
|
|
|
)
|
|
|
|
finally:
|
|
|
|
PDFLOCK.release()
|
2023-02-18 18:49:52 +01:00
|
|
|
date_iso = time.strftime("%Y-%m-%d")
|
2020-09-26 16:19:37 +02:00
|
|
|
if groups_infos:
|
|
|
|
groups_filename = "-" + groups_infos.groups_filename
|
|
|
|
else:
|
|
|
|
groups_filename = ""
|
2023-02-19 02:54:29 +01:00
|
|
|
filename = f"""PV-{formsemestre.titre_num()}{groups_filename}-{date_iso}.pdf"""
|
2021-09-21 15:53:33 +02:00
|
|
|
return scu.sendPDFFile(pdfdoc, filename)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2023-02-19 02:54:29 +01:00
|
|
|
def descrform_pvjury(formsemestre: FormSemestre):
|
2020-10-13 16:01:38 +02:00
|
|
|
"""Définition de formulaire pour PV jury PDF"""
|
2023-02-19 02:54:29 +01:00
|
|
|
f_dict = formsemestre.formation.to_dict()
|
2020-09-26 16:19:37 +02:00
|
|
|
return [
|
|
|
|
(
|
|
|
|
"date_commission",
|
|
|
|
{
|
|
|
|
"input_type": "text",
|
|
|
|
"size": 50,
|
|
|
|
"title": "Date de la commission",
|
|
|
|
"explanation": "(format libre)",
|
|
|
|
},
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"date_jury",
|
|
|
|
{
|
|
|
|
"input_type": "text",
|
|
|
|
"size": 50,
|
|
|
|
"title": "Date du Jury",
|
|
|
|
"explanation": "(si le jury a eu lieu)",
|
|
|
|
},
|
|
|
|
),
|
|
|
|
(
|
2023-02-19 02:54:29 +01:00
|
|
|
"numero_arrete",
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"input_type": "text",
|
|
|
|
"size": 50,
|
|
|
|
"title": "Numéro de l'arrêté du président",
|
|
|
|
"explanation": "le président de l'Université prend chaque année un arrêté formant les jurys",
|
|
|
|
},
|
|
|
|
),
|
|
|
|
(
|
2023-02-19 02:54:29 +01:00
|
|
|
"code_vdi",
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"input_type": "text",
|
|
|
|
"size": 15,
|
|
|
|
"title": "VDI et Code",
|
|
|
|
"explanation": "VDI et code du diplôme Apogée (format libre, n'est pas vérifié par ScoDoc)",
|
|
|
|
},
|
|
|
|
),
|
2023-10-18 15:55:51 +02:00
|
|
|
(
|
|
|
|
"pv_title_session",
|
|
|
|
{
|
|
|
|
"input_type": "text",
|
|
|
|
"size": 48,
|
|
|
|
"title": "Nom de la session",
|
|
|
|
"explanation": "utilisé dans le titre du PV",
|
|
|
|
"default": "Session unique",
|
|
|
|
},
|
|
|
|
),
|
2020-12-01 11:03:20 +01:00
|
|
|
(
|
|
|
|
"pv_title",
|
|
|
|
{
|
|
|
|
"input_type": "text",
|
2023-10-18 15:55:51 +02:00
|
|
|
"size": 96,
|
2020-12-01 11:03:20 +01:00
|
|
|
"title": "Titre du PV",
|
|
|
|
"explanation": "par défaut, titre officiel de la formation",
|
2023-02-18 00:13:00 +01:00
|
|
|
"default": f_dict["titre_officiel"],
|
2020-12-01 11:03:20 +01:00
|
|
|
},
|
|
|
|
),
|
2020-09-26 16:19:37 +02:00
|
|
|
(
|
2023-02-19 02:54:29 +01:00
|
|
|
"show_title",
|
2020-09-26 16:19:37 +02:00
|
|
|
{
|
|
|
|
"input_type": "checkbox",
|
2020-12-01 11:03:20 +01:00
|
|
|
"title": "Indiquer en plus le titre du semestre sur le PV",
|
2023-02-19 02:54:29 +01:00
|
|
|
"explanation": f'(le titre est "{formsemestre.titre}")',
|
2020-09-26 16:19:37 +02:00
|
|
|
"labels": [""],
|
|
|
|
"allowed_values": ("1",),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"with_paragraph_nom",
|
|
|
|
{
|
2021-02-05 21:34:26 +01:00
|
|
|
"input_type": "boolcheckbox",
|
2020-09-26 16:19:37 +02:00
|
|
|
"title": "Avec date naissance et code",
|
|
|
|
"explanation": "ajoute informations sous le nom",
|
2021-02-05 21:34:26 +01:00
|
|
|
"default": True,
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"anonymous",
|
|
|
|
{
|
|
|
|
"input_type": "checkbox",
|
|
|
|
"title": "PV anonyme",
|
|
|
|
"explanation": "remplace nom par code étudiant (INE ou NIP)",
|
|
|
|
"labels": [""],
|
|
|
|
"allowed_values": ("1",),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
("formsemestre_id", {"input_type": "hidden"}),
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2021-09-27 10:20:10 +02:00
|
|
|
def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[]):
|
2020-09-26 16:19:37 +02:00
|
|
|
"Lettres avis jury en PDF"
|
2022-07-03 08:31:01 +02:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
if not group_ids:
|
|
|
|
# tous les inscrits du semestre
|
2021-07-29 16:31:15 +02:00
|
|
|
group_ids = [sco_groups.get_default_group(formsemestre_id)]
|
2020-09-26 16:19:37 +02:00
|
|
|
groups_infos = sco_groups_view.DisplayedGroupsInfos(
|
2021-09-08 00:34:45 +02:00
|
|
|
group_ids, formsemestre_id=formsemestre_id
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
etudids = [m["etudid"] for m in groups_infos.members]
|
|
|
|
|
|
|
|
H = [
|
2021-06-13 19:12:20 +02:00
|
|
|
html_sco_header.html_sem_header(
|
2021-09-18 10:10:02 +02:00
|
|
|
"Édition des lettres individuelles",
|
2020-09-26 16:19:37 +02:00
|
|
|
javascripts=sco_groups_view.JAVASCRIPTS,
|
|
|
|
cssstyles=sco_groups_view.CSSSTYLES,
|
|
|
|
init_qtip=True,
|
|
|
|
),
|
2022-07-03 08:31:01 +02:00
|
|
|
f"""<p class="help">Utiliser cette page pour éditer des versions provisoires des PV.
|
2023-12-15 18:53:38 +01:00
|
|
|
<span class="fontred">Il est recommandé d'archiver les versions définitives: <a
|
2022-07-03 08:31:01 +02:00
|
|
|
href="{url_for(
|
|
|
|
"notes.formsemestre_archive",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)}"
|
|
|
|
>voir cette page</a></span></p>
|
|
|
|
""",
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
2021-07-29 10:19:00 +02:00
|
|
|
F = html_sco_header.sco_footer()
|
2020-09-26 16:19:37 +02:00
|
|
|
descr = descrform_lettres_individuelles()
|
|
|
|
menu_choix_groupe = (
|
|
|
|
"""<div class="group_ids_sel_menu">Groupes d'étudiants à lister: """
|
2021-08-20 10:51:42 +02:00
|
|
|
+ sco_groups_view.menu_groups_choice(groups_infos)
|
2020-09-26 16:19:37 +02:00
|
|
|
+ """</div>"""
|
|
|
|
)
|
|
|
|
|
|
|
|
tf = TrivialFormulator(
|
2021-09-18 10:10:02 +02:00
|
|
|
request.base_url,
|
2021-09-27 16:42:14 +02:00
|
|
|
scu.get_request_args(),
|
2020-09-26 16:19:37 +02:00
|
|
|
descr,
|
|
|
|
cancelbutton="Annuler",
|
|
|
|
submitlabel="Générer document",
|
|
|
|
name="tf",
|
|
|
|
formid="group_selector",
|
|
|
|
html_foot_markup=menu_choix_groupe,
|
|
|
|
)
|
|
|
|
if tf[0] == 0:
|
|
|
|
return "\n".join(H) + "\n" + tf[1] + F
|
|
|
|
elif tf[0] == -1:
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(
|
2022-07-03 08:31:01 +02:00
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_pvjury",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
# submit
|
|
|
|
sf = tf[2]["signature"]
|
|
|
|
signature = sf.read() # image of signature
|
|
|
|
try:
|
|
|
|
PDFLOCK.acquire()
|
2023-02-19 15:45:27 +01:00
|
|
|
pdfdoc = sco_pv_lettres_inviduelles.pdf_lettres_individuelles(
|
2020-09-26 16:19:37 +02:00
|
|
|
formsemestre_id,
|
|
|
|
etudids=etudids,
|
|
|
|
date_jury=tf[2]["date_jury"],
|
|
|
|
date_commission=tf[2]["date_commission"],
|
|
|
|
signature=signature,
|
|
|
|
)
|
|
|
|
finally:
|
|
|
|
PDFLOCK.release()
|
|
|
|
if not pdfdoc:
|
2022-07-03 08:31:01 +02:00
|
|
|
flash("Aucun étudiant n'a de décision de jury !")
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(
|
2022-07-03 08:31:01 +02:00
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
)
|
2022-07-03 08:31:01 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
groups_filename = "-" + groups_infos.groups_filename
|
2022-07-03 08:31:01 +02:00
|
|
|
filename = f"""lettres-{formsemestre.titre_num()}{groups_filename}-{time.strftime("%Y-%m-%d")}.pdf"""
|
2021-09-21 15:53:33 +02:00
|
|
|
return scu.sendPDFFile(pdfdoc, filename)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
def descrform_lettres_individuelles():
|
|
|
|
return [
|
|
|
|
(
|
|
|
|
"date_commission",
|
|
|
|
{
|
|
|
|
"input_type": "text",
|
|
|
|
"size": 50,
|
|
|
|
"title": "Date de la commission",
|
|
|
|
"explanation": "(format libre)",
|
|
|
|
},
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"date_jury",
|
|
|
|
{
|
|
|
|
"input_type": "text",
|
|
|
|
"size": 50,
|
|
|
|
"title": "Date du Jury",
|
|
|
|
"explanation": "(si le jury a eu lieu)",
|
|
|
|
},
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"signature",
|
|
|
|
{
|
|
|
|
"input_type": "file",
|
|
|
|
"size": 30,
|
|
|
|
"explanation": "optionnel: image scannée de la signature",
|
|
|
|
},
|
|
|
|
),
|
|
|
|
("formsemestre_id", {"input_type": "hidden"}),
|
|
|
|
]
|