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
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""Semestres: validation semestre et UE dans parcours
|
|
|
|
"""
|
2021-10-11 22:22:42 +02:00
|
|
|
import time
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2021-08-01 10:16:16 +02:00
|
|
|
import flask
|
2024-08-16 01:11:06 +02:00
|
|
|
from flask import flash, g, render_template, request, url_for
|
2023-06-25 11:49:11 +02:00
|
|
|
import sqlalchemy as sa
|
2021-07-11 17:37:12 +02:00
|
|
|
|
2024-02-25 22:35:14 +01:00
|
|
|
from app.models import Identite, Evaluation
|
2021-06-19 23:21:37 +02:00
|
|
|
import app.scodoc.notesdb as ndb
|
|
|
|
import app.scodoc.sco_utils as scu
|
2022-07-06 00:05:14 +02:00
|
|
|
from app import db, log
|
2022-02-02 22:22:56 +01:00
|
|
|
|
|
|
|
from app.comp import res_sem
|
2022-03-27 22:25:00 +02:00
|
|
|
from app.comp.res_compat import NotesTableCompat
|
2024-07-08 23:13:45 +02:00
|
|
|
from app.models import Formation, FormSemestre, UniteEns, ScolarNews, Scolog
|
2022-02-12 22:57:46 +01:00
|
|
|
from app.models.notes import etud_has_notes_attente
|
2022-07-06 00:05:14 +02:00
|
|
|
from app.models.validations import (
|
|
|
|
ScolarAutorisationInscription,
|
|
|
|
ScolarFormSemestreValidation,
|
|
|
|
)
|
|
|
|
from app.models.but_validations import ApcValidationRCUE, ApcValidationAnnee
|
2022-02-02 22:22:56 +01:00
|
|
|
from app.scodoc.sco_exceptions import ScoValueError
|
2023-02-12 13:36:47 +01:00
|
|
|
from app.scodoc.codes_cursus import *
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
|
|
|
|
2023-06-30 15:34:50 +02:00
|
|
|
from app.scodoc import sco_assiduites
|
2023-02-12 13:36:47 +01:00
|
|
|
from app.scodoc import codes_cursus
|
2021-07-19 19:53:01 +02:00
|
|
|
from app.scodoc import sco_cache
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import sco_formsemestre
|
|
|
|
from app.scodoc import sco_formsemestre_inscriptions
|
2022-07-07 16:24:52 +02:00
|
|
|
from app.scodoc import sco_cursus
|
|
|
|
from app.scodoc import sco_cursus_dut
|
|
|
|
from app.scodoc.sco_cursus_dut import etud_est_inscrit_ue
|
2021-06-19 23:21:37 +02:00
|
|
|
from app.scodoc import sco_preferences
|
2023-02-19 15:45:27 +01:00
|
|
|
from app.scodoc import sco_pv_dict
|
2023-06-15 08:49:05 +02:00
|
|
|
|
2023-07-11 06:57:38 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
# ------------------------------------------------------------------------------------
|
|
|
|
def formsemestre_validation_etud_form(
|
|
|
|
formsemestre_id=None, # required
|
|
|
|
etudid=None, # one of etudid or etud_index is required
|
|
|
|
etud_index=None,
|
|
|
|
check=0, # opt: si true, propose juste une relecture du parcours
|
2023-02-12 01:13:43 +01:00
|
|
|
dest_url=None,
|
2020-09-26 16:19:37 +02:00
|
|
|
sortcol=None,
|
2023-02-12 01:13:43 +01:00
|
|
|
read_only=True,
|
2020-09-26 16:19:37 +02:00
|
|
|
):
|
2024-08-24 18:26:51 +02:00
|
|
|
"""Formulaire de validation des décisions de jury (formations classiques)"""
|
2022-10-03 19:13:15 +02:00
|
|
|
formsemestre: FormSemestre = FormSemestre.query.filter_by(
|
|
|
|
id=formsemestre_id, dept_id=g.scodoc_dept_id
|
|
|
|
).first_or_404()
|
2023-03-20 11:17:38 +01:00
|
|
|
etud = Identite.get_etud(etudid)
|
|
|
|
|
2022-02-12 22:57:46 +01:00
|
|
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
2020-09-26 16:19:37 +02:00
|
|
|
T = nt.get_table_moyennes_triees()
|
2021-08-22 00:28:17 +02:00
|
|
|
if not etudid and etud_index is None:
|
2020-09-26 16:19:37 +02:00
|
|
|
raise ValueError("formsemestre_validation_etud_form: missing argument etudid")
|
2021-08-22 00:28:17 +02:00
|
|
|
if etud_index is not None:
|
2020-09-26 16:19:37 +02:00
|
|
|
etud_index = int(etud_index)
|
|
|
|
# cherche l'etudid correspondant
|
|
|
|
if etud_index < 0 or etud_index >= len(T):
|
|
|
|
raise ValueError(
|
|
|
|
"formsemestre_validation_etud_form: invalid etud_index value"
|
|
|
|
)
|
|
|
|
etudid = T[etud_index][-1]
|
|
|
|
else:
|
|
|
|
# cherche index pour liens navigation
|
|
|
|
etud_index = len(T) - 1
|
|
|
|
while etud_index >= 0 and T[etud_index][-1] != etudid:
|
|
|
|
etud_index -= 1
|
|
|
|
if etud_index < 0:
|
|
|
|
raise ValueError(
|
|
|
|
"formsemestre_validation_etud_form: can't retreive etud_index !"
|
|
|
|
)
|
|
|
|
# prev, next pour liens navigation
|
|
|
|
etud_index_next = etud_index + 1
|
|
|
|
if etud_index_next >= len(T):
|
|
|
|
etud_index_next = None
|
|
|
|
etud_index_prev = etud_index - 1
|
|
|
|
if etud_index_prev < 0:
|
|
|
|
etud_index_prev = None
|
2023-02-12 01:13:43 +01:00
|
|
|
if read_only:
|
2020-09-26 16:19:37 +02:00
|
|
|
check = True
|
|
|
|
|
2024-06-07 17:58:02 +02:00
|
|
|
Se = sco_cursus.get_situation_etud_cursus(etud, formsemestre_id)
|
2021-08-10 12:57:38 +02:00
|
|
|
if not Se.sem["etat"]:
|
2020-09-26 16:19:37 +02:00
|
|
|
raise ScoValueError("validation: semestre verrouille")
|
|
|
|
|
2022-04-07 23:31:08 +02:00
|
|
|
url_tableau = url_for(
|
|
|
|
"notes.formsemestre_recapcomplet",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
2022-06-29 16:30:01 +02:00
|
|
|
mode_jury=1,
|
2022-04-07 23:31:08 +02:00
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
selected_etudid=etudid, # va a la bonne ligne
|
|
|
|
)
|
|
|
|
|
2024-08-24 18:26:51 +02:00
|
|
|
H = []
|
2020-09-26 16:19:37 +02:00
|
|
|
# Navigation suivant/precedent
|
2022-04-07 23:31:08 +02:00
|
|
|
if etud_index_prev is not None:
|
2023-03-20 11:17:38 +01:00
|
|
|
etud_prev = Identite.get_etud(T[etud_index_prev][-1])
|
2022-04-07 23:31:08 +02:00
|
|
|
url_prev = url_for(
|
|
|
|
"notes.formsemestre_validation_etud_form",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
etud_index=etud_index_prev,
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-04-07 23:31:08 +02:00
|
|
|
else:
|
|
|
|
url_prev = None
|
|
|
|
if etud_index_next is not None:
|
2023-03-20 11:17:38 +01:00
|
|
|
etud_next = Identite.get_etud(T[etud_index_next][-1])
|
2022-04-07 23:31:08 +02:00
|
|
|
url_next = url_for(
|
|
|
|
"notes.formsemestre_validation_etud_form",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre_id,
|
|
|
|
etud_index=etud_index_next,
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
url_next = None
|
|
|
|
footer = ["""<div class="jury_footer"><span>"""]
|
|
|
|
if url_prev:
|
|
|
|
footer.append(
|
|
|
|
f'< <a class="stdlink" href="{url_prev}">{etud_prev.nomprenom}</a>'
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-04-07 23:31:08 +02:00
|
|
|
footer.append(
|
|
|
|
f"""</span><span><a class="stdlink" href="{url_tableau}">retour à la liste</a></span><span>"""
|
|
|
|
)
|
|
|
|
if url_next:
|
|
|
|
footer.append(
|
|
|
|
f'<a class="stdlink" href="{url_next}">{etud_next.nomprenom}</a> >'
|
|
|
|
)
|
|
|
|
footer.append("</span></div>")
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append('<table style="width: 100%"><tr><td>')
|
|
|
|
if not check:
|
|
|
|
H.append(
|
2024-01-20 14:49:36 +01:00
|
|
|
f"""<h2 class="formsemestre">{etud.nomprenom}: validation {
|
|
|
|
Se.parcours.SESSION_NAME_A}{Se.parcours.SESSION_NAME
|
|
|
|
}</h2>Parcours: {Se.get_cursus_descr()}
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
H.append(
|
2024-01-20 14:49:36 +01:00
|
|
|
f"""<h2 class="formsemestre">Parcours de {etud.nomprenom}</h2>{Se.get_cursus_descr()}"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
H.append(
|
2024-01-20 14:49:36 +01:00
|
|
|
f"""</td><td style="text-align: right;"><a href="{
|
|
|
|
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
|
|
|
}">{etud.photo_html(title="fiche de " + etud.nomprenom)}</a></td></tr>
|
|
|
|
</table>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
etud_etat = nt.get_etud_etat(etudid)
|
2022-09-30 22:43:39 +02:00
|
|
|
if etud_etat == scu.DEMISSION:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append('<div class="ue_warning"><span>Etudiant démissionnaire</span></div>')
|
2022-09-30 22:43:39 +02:00
|
|
|
if etud_etat == scu.DEF:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append('<div class="ue_warning"><span>Etudiant défaillant</span></div>')
|
2022-09-30 22:43:39 +02:00
|
|
|
if etud_etat != scu.INSCRIT:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-10-03 19:13:15 +02:00
|
|
|
f"""
|
|
|
|
<div class="warning">
|
|
|
|
Impossible de statuer sur cet étudiant:
|
2021-09-28 07:27:55 +02:00
|
|
|
il est démissionnaire ou défaillant (voir <a href="{
|
2024-01-20 14:49:36 +01:00
|
|
|
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
2021-09-28 07:27:55 +02:00
|
|
|
}">sa fiche</a>)
|
2022-10-03 19:13:15 +02:00
|
|
|
</div>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-08-24 18:26:51 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
javascripts=["js/recap_parcours.js"],
|
|
|
|
title=f"Parcours {etud.nomprenom}",
|
|
|
|
content="\n".join(H + footer),
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
H.append(
|
|
|
|
formsemestre_recap_parcours_table(
|
2023-02-12 01:13:43 +01:00
|
|
|
Se, etudid, with_links=(check and not read_only)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
if check:
|
2023-02-12 01:13:43 +01:00
|
|
|
if not dest_url:
|
|
|
|
dest_url = url_tableau
|
|
|
|
H.append(f'<ul><li><a href="{dest_url}">Continuer</a></li></ul>')
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-08-24 18:26:51 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
javascripts=["js/recap_parcours.js"],
|
|
|
|
title=f"Parcours {etud.nomprenom}",
|
|
|
|
content="\n".join(H + footer),
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
decision_jury = Se.nt.get_etud_decision_sem(etudid)
|
|
|
|
|
|
|
|
# Bloque si note en attente
|
2022-02-12 22:57:46 +01:00
|
|
|
if etud_has_notes_attente(etudid, formsemestre_id):
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
|
|
|
tf_error_message(
|
2021-09-28 07:27:55 +02:00
|
|
|
f"""Impossible de statuer sur cet étudiant: il a des notes en
|
2024-02-25 22:35:14 +01:00
|
|
|
attente dans des évaluations de ce semestre (voir
|
|
|
|
<a class="stdlink"
|
|
|
|
href="{
|
2021-09-28 07:27:55 +02:00
|
|
|
url_for( "notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre_id)
|
|
|
|
}">tableau de bord</a>)
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
)
|
2024-08-24 18:26:51 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
javascripts=["js/recap_parcours.js"],
|
|
|
|
title=f"Parcours {etud.nomprenom}",
|
|
|
|
content="\n".join(H + footer),
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-02-25 22:35:14 +01:00
|
|
|
evaluations_a_debloquer = Evaluation.get_evaluations_blocked_for_etud(
|
|
|
|
formsemestre, etud
|
|
|
|
)
|
|
|
|
if evaluations_a_debloquer:
|
|
|
|
links_evals = [
|
|
|
|
f"""<a class="stdlink" href="{url_for(
|
|
|
|
'notes.evaluation_listenotes', scodoc_dept=g.scodoc_dept, evaluation_id=e.id
|
|
|
|
)}">{e.description} en {e.moduleimpl.module.code}</a>"""
|
|
|
|
for e in evaluations_a_debloquer
|
|
|
|
]
|
|
|
|
H.append(
|
|
|
|
tf_error_message(
|
|
|
|
f"""Impossible de statuer sur cet étudiant:
|
|
|
|
il a des notes dans des évaluations qui seront débloquées plus tard:
|
|
|
|
voir {", ".join(links_evals)}
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
)
|
2024-08-24 18:26:51 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
javascripts=["js/recap_parcours.js"],
|
|
|
|
title=f"Parcours {etud.nomprenom}",
|
|
|
|
content="\n".join(H + footer),
|
|
|
|
)
|
2024-02-25 22:35:14 +01:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
# Infos si pas de semestre précédent
|
2024-06-07 17:58:02 +02:00
|
|
|
if not Se.prev_formsemestre:
|
|
|
|
if Se.cur_sem.semestre_id == 1:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append("<p>Premier semestre (pas de précédent)</p>")
|
|
|
|
else:
|
|
|
|
H.append("<p>Pas de semestre précédent !</p>")
|
|
|
|
else:
|
|
|
|
if not Se.prev_decision:
|
|
|
|
H.append(
|
|
|
|
tf_error_message(
|
2021-09-28 07:27:55 +02:00
|
|
|
f"""Le jury n'a pas statué sur le semestre précédent ! (<a href="{
|
|
|
|
url_for("notes.formsemestre_validation_etud_form",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
2024-06-07 17:58:02 +02:00
|
|
|
formsemestre_id=Se.prev_formsemestre.id,
|
2021-09-28 07:27:55 +02:00
|
|
|
etudid=etudid)
|
|
|
|
}">le faire maintenant</a>)
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
if decision_jury:
|
|
|
|
H.append(
|
2021-09-28 07:27:55 +02:00
|
|
|
f"""<a href="{
|
|
|
|
url_for("notes.formsemestre_validation_suppress_etud",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
etudid=etudid, formsemestre_id=formsemestre_id
|
|
|
|
)
|
|
|
|
}" class="stdlink">Supprimer décision existante</a>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-08-24 18:26:51 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
javascripts=["js/recap_parcours.js"],
|
|
|
|
title=f"Parcours {etud.nomprenom}",
|
|
|
|
content="\n".join(H),
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
# Infos sur decisions déjà saisies
|
|
|
|
if decision_jury:
|
|
|
|
if decision_jury["assidu"]:
|
|
|
|
ass = "assidu"
|
|
|
|
else:
|
|
|
|
ass = "non assidu"
|
|
|
|
H.append("<p>Décision existante du %(event_date)s: %(code)s" % decision_jury)
|
|
|
|
H.append(" (%s)" % ass)
|
2022-07-07 16:24:52 +02:00
|
|
|
autorisations = ScolarAutorisationInscription.query.filter_by(
|
|
|
|
etudid=etudid, origin_formsemestre_id=formsemestre_id
|
|
|
|
).all()
|
|
|
|
if autorisations:
|
2024-01-20 14:49:36 +01:00
|
|
|
H.append(f". Autorisé{etud.e} à s'inscrire en ")
|
2022-07-07 16:24:52 +02:00
|
|
|
H.append(", ".join([f"S{aut.semestre_id}" for aut in autorisations]) + ".")
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append("</p>")
|
|
|
|
|
|
|
|
# Cas particulier pour ATJ: corriger precedent avant de continuer
|
2024-06-07 17:58:02 +02:00
|
|
|
if Se.prev_formsemestre and Se.prev_decision and Se.prev_decision["code"] == ATJ:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2024-06-07 17:58:02 +02:00
|
|
|
f"""<div class="sfv_warning"><p>La décision du semestre précédent est en
|
2020-09-26 16:19:37 +02:00
|
|
|
<b>attente</b> à cause d\'un <b>problème d\'assiduité<b>.</p>
|
|
|
|
<p>Vous devez la corriger avant de continuer ce jury. Soit vous considérez que le
|
|
|
|
problème d'assiduité n'est pas réglé et choisissez de ne pas valider le semestre
|
|
|
|
précédent (échec), soit vous entrez une décision sans prendre en compte
|
|
|
|
l'assiduité.</p>
|
|
|
|
<form method="get" action="formsemestre_validation_etud_form">
|
|
|
|
<input type="submit" value="Statuer sur le semestre précédent"/>
|
2024-06-07 17:58:02 +02:00
|
|
|
<input type="hidden" name="formsemestre_id" value="{Se.prev_formsemestre.id}"/>
|
|
|
|
<input type="hidden" name="etudid" value="{etudid}"/>
|
|
|
|
<input type="hidden" name="desturl" value="{
|
|
|
|
url_for("notes.formsemestre_validation_etud_form",
|
|
|
|
etudid=etudid, formsemestre_id=formsemestre_id, scodoc_dept=g.scodoc_dept
|
|
|
|
)}"/>
|
2020-09-26 16:19:37 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
if sortcol:
|
2024-06-07 17:58:02 +02:00
|
|
|
H.append(f"""<input type="hidden" name="sortcol" value="{sortcol}"/>""")
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append("</form></div>")
|
|
|
|
|
2024-08-24 18:26:51 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
javascripts=["js/recap_parcours.js"],
|
|
|
|
title=f"Parcours {etud.nomprenom}",
|
|
|
|
content="\n".join(H),
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
# Explication sur barres actuelles
|
|
|
|
H.append('<p class="sfv_explication">L\'étudiant ')
|
|
|
|
if Se.barre_moy_ok:
|
|
|
|
H.append("a la moyenne générale, ")
|
|
|
|
else:
|
|
|
|
H.append("<b>n'a pas</b> la moyenne générale, ")
|
|
|
|
|
|
|
|
H.append(Se.barres_ue_diag) # eg 'les UEs sont au dessus des barres'
|
|
|
|
|
|
|
|
if (not Se.barre_moy_ok) and Se.can_compensate_with_prev:
|
|
|
|
H.append(", et ce semestre peut se <b>compenser</b> avec le précédent")
|
|
|
|
H.append(".</p>")
|
|
|
|
|
|
|
|
# Décisions possibles
|
|
|
|
rows_assidu = decisions_possible_rows(
|
2022-09-03 11:41:56 +02:00
|
|
|
Se, True, subtitle="Étudiant assidu:", trclass="sfv_ass"
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
rows_non_assidu = decisions_possible_rows(
|
|
|
|
Se, False, subtitle="Si problème d'assiduité:", trclass="sfv_pbass"
|
|
|
|
)
|
|
|
|
# s'il y a des decisions recommandees issues des regles:
|
|
|
|
if rows_assidu or rows_non_assidu:
|
|
|
|
H.append(
|
|
|
|
"""<form method="get" action="formsemestre_validation_etud" id="formvalid" class="sfv_decisions">
|
|
|
|
<input type="hidden" name="etudid" value="%s"/>
|
|
|
|
<input type="hidden" name="formsemestre_id" value="%s"/>"""
|
|
|
|
% (etudid, formsemestre_id)
|
|
|
|
)
|
2023-02-12 01:13:43 +01:00
|
|
|
if dest_url:
|
|
|
|
H.append('<input type="hidden" name="desturl" value="%s"/>' % dest_url)
|
2020-09-26 16:19:37 +02:00
|
|
|
if sortcol:
|
|
|
|
H.append('<input type="hidden" name="sortcol" value="%s"/>' % sortcol)
|
|
|
|
|
|
|
|
H.append('<h3 class="sfv">Décisions <em>recommandées</em> :</h3>')
|
|
|
|
H.append("<table>")
|
|
|
|
H.append(rows_assidu)
|
|
|
|
if rows_non_assidu:
|
|
|
|
H.append("<tr><td> </td></tr>") # spacer
|
|
|
|
H.append(rows_non_assidu)
|
|
|
|
|
|
|
|
H.append("</table>")
|
|
|
|
H.append(
|
2022-10-02 23:43:29 +02:00
|
|
|
'<p><br></p><input type="submit" value="Valider ce choix" disabled="1" id="subut"/>'
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
H.append("</form>")
|
|
|
|
|
2021-08-21 00:24:51 +02:00
|
|
|
H.append(form_decision_manuelle(Se, formsemestre_id, etudid))
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
H.append(
|
2021-08-30 23:28:15 +02:00
|
|
|
f"""<div class="link_defaillance">Ou <a class="stdlink" href="{
|
2023-10-19 21:07:03 +02:00
|
|
|
url_for("scolar.form_def", scodoc_dept=g.scodoc_dept, etudid=etudid,
|
2021-08-30 23:28:15 +02:00
|
|
|
formsemestre_id=formsemestre_id)
|
|
|
|
}">déclarer l'étudiant comme défaillant dans ce semestre</a></div>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
H.append('<p style="font-size: 50%;">Formation ')
|
2021-08-11 00:36:07 +02:00
|
|
|
if Se.sem["gestion_semestrielle"]:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append("avec semestres décalés</p>")
|
|
|
|
else:
|
|
|
|
H.append("sans semestres décalés</p>")
|
|
|
|
|
2024-08-24 18:26:51 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
javascripts=["js/recap_parcours.js"],
|
|
|
|
title=f"Parcours {etud.nomprenom}",
|
|
|
|
content="\n".join(H + footer),
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
def formsemestre_validation_etud(
|
|
|
|
formsemestre_id=None, # required
|
|
|
|
etudid=None, # required
|
|
|
|
codechoice=None, # required
|
|
|
|
desturl="",
|
|
|
|
sortcol=None,
|
|
|
|
):
|
|
|
|
"""Enregistre validation"""
|
2024-06-07 17:58:02 +02:00
|
|
|
etud = Identite.get_etud(etudid)
|
2022-07-07 16:24:52 +02:00
|
|
|
Se = sco_cursus.get_situation_etud_cursus(etud, formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
# retrouve la decision correspondant au code:
|
|
|
|
choices = Se.get_possible_choices(assiduite=True)
|
|
|
|
choices += Se.get_possible_choices(assiduite=False)
|
2021-06-19 23:21:37 +02:00
|
|
|
selected_choice = None
|
2020-09-26 16:19:37 +02:00
|
|
|
for choice in choices:
|
|
|
|
if choice.codechoice == codechoice:
|
2021-06-19 23:21:37 +02:00
|
|
|
selected_choice = choice
|
2020-09-26 16:19:37 +02:00
|
|
|
break
|
2021-06-19 23:21:37 +02:00
|
|
|
if not selected_choice:
|
2023-06-30 17:26:41 +02:00
|
|
|
raise ValueError(f"code choix invalide ! ({codechoice})")
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
2021-09-27 10:20:10 +02:00
|
|
|
Se.valide_decision(selected_choice) # enregistre
|
2021-02-07 15:31:35 +01:00
|
|
|
return _redirect_valid_choice(
|
2021-09-24 00:28:09 +02:00
|
|
|
formsemestre_id, etudid, Se, selected_choice, desturl, sortcol
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def formsemestre_validation_etud_manu(
|
|
|
|
formsemestre_id=None, # required
|
|
|
|
etudid=None, # required
|
|
|
|
code_etat="",
|
|
|
|
new_code_prev="",
|
|
|
|
devenir="", # required (la decision manuelle)
|
|
|
|
assidu=False,
|
|
|
|
desturl="",
|
|
|
|
sortcol=None,
|
|
|
|
redirect=True,
|
|
|
|
):
|
|
|
|
"""Enregistre validation"""
|
|
|
|
if assidu:
|
2021-08-11 00:36:07 +02:00
|
|
|
assidu = True
|
2024-06-07 17:58:02 +02:00
|
|
|
etud = Identite.get_etud(etudid)
|
2022-07-07 16:24:52 +02:00
|
|
|
Se = sco_cursus.get_situation_etud_cursus(etud, formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
if code_etat in Se.parcours.UNUSED_CODES:
|
|
|
|
raise ScoValueError("code decision invalide dans ce parcours")
|
|
|
|
# Si code ADC, extrait le semestre utilisé:
|
|
|
|
if code_etat[:3] == ADC:
|
|
|
|
formsemestre_id_utilise_pour_compenser = code_etat.split("_")[1]
|
|
|
|
if not formsemestre_id_utilise_pour_compenser:
|
|
|
|
formsemestre_id_utilise_pour_compenser = (
|
|
|
|
None # compense avec semestre hors ScoDoc
|
|
|
|
)
|
|
|
|
code_etat = ADC
|
|
|
|
else:
|
|
|
|
formsemestre_id_utilise_pour_compenser = None
|
|
|
|
|
|
|
|
# Construit le choix correspondant:
|
2022-07-07 16:24:52 +02:00
|
|
|
choice = sco_cursus_dut.DecisionSem(
|
2020-09-26 16:19:37 +02:00
|
|
|
code_etat=code_etat,
|
|
|
|
new_code_prev=new_code_prev,
|
|
|
|
devenir=devenir,
|
|
|
|
assiduite=assidu,
|
|
|
|
formsemestre_id_utilise_pour_compenser=formsemestre_id_utilise_pour_compenser,
|
|
|
|
)
|
|
|
|
#
|
2021-09-27 10:20:10 +02:00
|
|
|
Se.valide_decision(choice) # enregistre
|
2020-09-26 16:19:37 +02:00
|
|
|
if redirect:
|
2021-02-07 15:31:35 +01:00
|
|
|
return _redirect_valid_choice(
|
2021-09-24 00:28:09 +02:00
|
|
|
formsemestre_id, etudid, Se, choice, desturl, sortcol
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-09-24 00:28:09 +02:00
|
|
|
def _redirect_valid_choice(formsemestre_id, etudid, Se, choice, desturl, sortcol):
|
2021-06-13 23:37:14 +02:00
|
|
|
adr = "formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&check=1" % (
|
|
|
|
formsemestre_id,
|
|
|
|
etudid,
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
if sortcol:
|
2021-09-24 00:28:09 +02:00
|
|
|
adr += "&sortcol=" + str(sortcol)
|
2021-02-07 15:31:35 +01:00
|
|
|
# if desturl:
|
2021-05-11 11:48:32 +02:00
|
|
|
# desturl += "&desturl=" + desturl
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(adr)
|
2020-09-26 16:19:37 +02:00
|
|
|
# Si le precedent a été modifié, demande relecture du parcours.
|
|
|
|
# sinon renvoie au listing general,
|
|
|
|
|
|
|
|
|
|
|
|
def _dispcode(c):
|
|
|
|
if not c:
|
|
|
|
return ""
|
|
|
|
return c
|
|
|
|
|
|
|
|
|
|
|
|
def decisions_possible_rows(Se, assiduite, subtitle="", trclass=""):
|
|
|
|
"Liste HTML des decisions possibles"
|
|
|
|
choices = Se.get_possible_choices(assiduite=assiduite)
|
|
|
|
if not choices:
|
|
|
|
return ""
|
2024-06-07 17:58:02 +02:00
|
|
|
prev_title = ""
|
|
|
|
if Se.prev_formsemestre:
|
|
|
|
if Se.prev_formsemestre.semestre_id >= 0:
|
|
|
|
prev_title = "%s%d" % (
|
|
|
|
Se.parcours.SESSION_ABBRV,
|
|
|
|
Se.prev_formsemestre.semestre_id,
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2024-06-07 17:58:02 +02:00
|
|
|
prev_title = "Prec."
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-06-07 17:58:02 +02:00
|
|
|
if Se.cur_sem.semestre_id >= 0:
|
|
|
|
cur_title = "%s%d" % (Se.parcours.SESSION_ABBRV, Se.cur_sem.semestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2024-06-07 17:58:02 +02:00
|
|
|
cur_title = Se.parcours.SESSION_NAME
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
H = [
|
|
|
|
'<tr class="%s titles"><th class="sfv_subtitle">%s</em></th>'
|
|
|
|
% (trclass, subtitle)
|
|
|
|
]
|
2024-06-07 17:58:02 +02:00
|
|
|
if Se.prev_formsemestre:
|
|
|
|
H.append(f"<th>Code {prev_title}</th>")
|
|
|
|
H.append(f"<th>Code {cur_title}</th><th>Devenir</th></tr>")
|
2020-09-26 16:19:37 +02:00
|
|
|
for ch in choices:
|
|
|
|
H.append(
|
|
|
|
"""<tr class="%s"><td title="règle %s"><input type="radio" name="codechoice" value="%s" onClick="document.getElementById('subut').disabled=false;">"""
|
|
|
|
% (trclass, ch.rule_id, ch.codechoice)
|
|
|
|
)
|
|
|
|
H.append("%s </input></td>" % ch.explication)
|
2024-06-07 17:58:02 +02:00
|
|
|
if Se.prev_formsemestre:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append('<td class="centercell">%s</td>' % _dispcode(ch.new_code_prev))
|
|
|
|
H.append(
|
|
|
|
'<td class="centercell">%s</td><td>%s</td>'
|
|
|
|
% (_dispcode(ch.code_etat), Se.explique_devenir(ch.devenir))
|
|
|
|
)
|
|
|
|
H.append("</tr>")
|
|
|
|
|
|
|
|
return "\n".join(H)
|
|
|
|
|
|
|
|
|
|
|
|
def formsemestre_recap_parcours_table(
|
2023-06-23 17:51:17 +02:00
|
|
|
situation_etud_cursus: sco_cursus_dut.SituationEtudCursus,
|
2020-09-26 16:19:37 +02:00
|
|
|
etudid,
|
|
|
|
with_links=False,
|
|
|
|
with_all_columns=True,
|
2021-10-11 22:22:42 +02:00
|
|
|
sem_info=None,
|
2020-09-26 16:19:37 +02:00
|
|
|
show_details=False,
|
|
|
|
):
|
|
|
|
"""Tableau HTML recap parcours
|
2021-01-01 18:40:47 +01:00
|
|
|
Si with_links, ajoute liens pour modifier decisions (colonne de droite)
|
2020-09-26 16:19:37 +02:00
|
|
|
sem_info = { formsemestre_id : txt } permet d'ajouter des informations associées à chaque semestre
|
|
|
|
with_all_columns: si faux, pas de colonne "assiduité".
|
|
|
|
"""
|
2021-10-11 22:22:42 +02:00
|
|
|
sem_info = sem_info or {}
|
2020-09-26 16:19:37 +02:00
|
|
|
H = []
|
|
|
|
linktmpl = '<span onclick="toggle_vis(this);" class="toggle_sem sem_%%s">%s</span>'
|
2021-02-04 20:02:44 +01:00
|
|
|
minuslink = linktmpl % scu.icontag("minus_img", border="0", alt="-")
|
|
|
|
pluslink = linktmpl % scu.icontag("plus_img", border="0", alt="+")
|
2020-09-26 16:19:37 +02:00
|
|
|
if show_details:
|
|
|
|
sd = " recap_show_details"
|
|
|
|
plusminus = minuslink
|
|
|
|
else:
|
|
|
|
sd = " recap_hide_details"
|
|
|
|
plusminus = pluslink
|
|
|
|
H.append(
|
2023-02-17 21:22:54 +01:00
|
|
|
f"""<table class="recap_parcours{sd}">
|
|
|
|
<tr>
|
|
|
|
<th><span onclick="toggle_all_sems(this);"
|
|
|
|
title="Ouvrir/fermer tous les semestres">{
|
|
|
|
scu.icontag("plus18_img", width=18, height=18, border=0, title="", alt="+")
|
|
|
|
}</span></th>
|
|
|
|
<th></th>
|
|
|
|
<th>Semestre</th>
|
|
|
|
<th>Etat</th>
|
|
|
|
<th>Abs</th>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
# titres des UE
|
2023-06-23 17:51:17 +02:00
|
|
|
H.append("<th></th>" * situation_etud_cursus.nb_max_ue)
|
2020-09-26 16:19:37 +02:00
|
|
|
#
|
|
|
|
if with_links:
|
|
|
|
H.append("<th></th>")
|
|
|
|
H.append("<th></th></tr>")
|
|
|
|
|
2023-02-17 21:22:54 +01:00
|
|
|
num_sem = 0
|
2024-06-07 17:58:02 +02:00
|
|
|
for formsemestre in situation_etud_cursus.formsemestres:
|
|
|
|
is_prev = situation_etud_cursus.prev_formsemestre and (
|
|
|
|
situation_etud_cursus.prev_formsemestre.id == formsemestre.id
|
2023-06-23 17:51:17 +02:00
|
|
|
)
|
2024-06-07 17:58:02 +02:00
|
|
|
is_cur = situation_etud_cursus.formsemestre_id == formsemestre.id
|
2020-09-26 16:19:37 +02:00
|
|
|
num_sem += 1
|
2024-08-24 08:06:46 +02:00
|
|
|
url_status = url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2024-06-07 17:58:02 +02:00
|
|
|
dpv = sco_pv_dict.dict_pvjury(formsemestre.id, etudids=[etudid])
|
2020-09-26 16:19:37 +02:00
|
|
|
pv = dpv["decisions"][0]
|
|
|
|
decision_sem = pv["decision_sem"]
|
|
|
|
decisions_ue = pv["decisions_ue"]
|
2021-08-11 00:36:07 +02:00
|
|
|
if with_all_columns and decision_sem and not decision_sem["assidu"]:
|
2020-09-26 16:19:37 +02:00
|
|
|
ass = " (non ass.)"
|
|
|
|
else:
|
|
|
|
ass = ""
|
|
|
|
|
2022-02-06 16:09:17 +01:00
|
|
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
2020-09-26 16:19:37 +02:00
|
|
|
if is_cur:
|
|
|
|
type_sem = "*" # now unused
|
|
|
|
class_sem = "sem_courant"
|
|
|
|
elif is_prev:
|
|
|
|
type_sem = "p"
|
|
|
|
class_sem = "sem_precedent"
|
|
|
|
else:
|
|
|
|
type_sem = ""
|
|
|
|
class_sem = "sem_autre"
|
2024-06-07 17:58:02 +02:00
|
|
|
if (
|
|
|
|
formsemestre.formation.formation_code
|
|
|
|
!= situation_etud_cursus.formation.formation_code
|
|
|
|
):
|
2020-09-26 16:19:37 +02:00
|
|
|
class_sem += " sem_autre_formation"
|
2024-06-07 17:58:02 +02:00
|
|
|
bgcolor = (
|
|
|
|
formsemestre.bul_bgcolor
|
|
|
|
if formsemestre.bul_bgcolor
|
|
|
|
else "background-color: rgb(255,255,240)"
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
# 1ere ligne: titre sem, decision, acronymes UE
|
2024-06-07 17:58:02 +02:00
|
|
|
H.append('<tr class="%s rcp_l1 sem_%s">' % (class_sem, formsemestre.id))
|
2020-09-26 16:19:37 +02:00
|
|
|
if is_cur:
|
|
|
|
pm = ""
|
|
|
|
elif is_prev:
|
2024-06-07 17:58:02 +02:00
|
|
|
pm = minuslink % formsemestre.id
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2024-06-07 17:58:02 +02:00
|
|
|
pm = plusminus % formsemestre.id
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2022-05-28 11:38:22 +02:00
|
|
|
inscr = formsemestre.etuds_inscriptions.get(etudid)
|
2023-02-17 21:22:54 +01:00
|
|
|
parcours_name = ""
|
|
|
|
if inscr and nt.is_apc:
|
|
|
|
if inscr.parcour:
|
|
|
|
parcours_name = (
|
|
|
|
f' <span class="code_parcours">{inscr.parcour.code}</span>'
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
# si l'étudiant n'est pas inscrit à un parcours mais que le semestre a plus d'UE
|
|
|
|
# signale un éventuel problème:
|
2023-04-03 17:46:31 +02:00
|
|
|
if len(nt.formsemestre.get_ues()) > len(
|
|
|
|
nt.etud_ues_ids(etudid)
|
|
|
|
): # XXX sans dispenses
|
2023-02-17 21:22:54 +01:00
|
|
|
parcours_name = f"""
|
|
|
|
<span class="code_parcours no_parcours">{scu.EMO_WARNING} pas de parcours
|
|
|
|
</span>"""
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-05-28 11:38:22 +02:00
|
|
|
f"""
|
|
|
|
<td class="rcp_type_sem" style="background-color:{bgcolor};">{num_sem}{pm}</td>
|
2024-08-24 08:06:46 +02:00
|
|
|
<td class="datedebut"><a href="{url_status}">{formsemestre.mois_debut()}</a></td>
|
2022-05-28 11:38:22 +02:00
|
|
|
<td class="rcp_titre_sem"><a class="formsemestre_status_link"
|
2024-06-07 17:58:02 +02:00
|
|
|
href="{
|
|
|
|
url_for("notes.formsemestre_bulletinetud", scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id, etudid=etudid
|
|
|
|
)}"
|
2023-01-26 16:35:15 +01:00
|
|
|
title="Bulletin de notes">{formsemestre.titre_annee()}{parcours_name}</a>
|
2022-05-28 11:38:22 +02:00
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2023-01-26 16:35:15 +01:00
|
|
|
if nt.is_apc:
|
|
|
|
H.append(
|
|
|
|
f"""<a class="stdlink jury_link" title="Validations du semestre BUT"
|
|
|
|
href="{ url_for("notes.formsemestre_validation_but",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
etudid=etudid,
|
|
|
|
)
|
|
|
|
}">jury</a>"""
|
|
|
|
)
|
|
|
|
H.append("""</td>""")
|
|
|
|
|
2022-06-30 20:43:09 +02:00
|
|
|
if nt.is_apc:
|
|
|
|
H.append('<td class="rcp_but">BUT</td>')
|
|
|
|
elif decision_sem:
|
2022-11-27 19:07:42 +01:00
|
|
|
H.append(
|
|
|
|
f"""<td class="rcp_dec">{
|
|
|
|
decision_sem["code"]}</td>"""
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2022-06-30 20:43:09 +02:00
|
|
|
H.append("<td><em>en cours</em></td>")
|
2022-11-27 19:07:42 +01:00
|
|
|
H.append(f"""<td class="rcp_nonass">{ass}</td>""") # abs
|
2022-02-27 20:12:20 +01:00
|
|
|
# acronymes UEs auxquelles l'étudiant est inscrit (ou capitalisé)
|
2023-06-23 17:51:17 +02:00
|
|
|
ues = list(nt.etud_ues(etudid)) # nb: en BUT, les UE "dispensées" sont incluses
|
2021-12-24 00:08:25 +01:00
|
|
|
cnx = ndb.GetDBConnexion()
|
2022-11-27 19:07:42 +01:00
|
|
|
etud_ue_status = {ue.id: nt.get_etud_ue_status(etudid, ue.id) for ue in ues}
|
2022-03-21 22:29:55 +01:00
|
|
|
if not nt.is_apc:
|
|
|
|
# formations classiques: filtre UE sur inscriptions (et garde UE capitalisées)
|
|
|
|
ues = [
|
|
|
|
ue
|
|
|
|
for ue in ues
|
2024-06-07 17:58:02 +02:00
|
|
|
if etud_est_inscrit_ue(cnx, etudid, formsemestre.id, ue.id)
|
2022-11-27 19:07:42 +01:00
|
|
|
or etud_ue_status[ue.id]["is_capitalized"]
|
2022-03-21 22:29:55 +01:00
|
|
|
]
|
2021-12-24 00:08:25 +01:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
for ue in ues:
|
2022-11-27 19:07:42 +01:00
|
|
|
H.append(f"""<td class="ue_acro"><span>{ue.acronyme}</span></td>""")
|
2023-06-23 17:51:17 +02:00
|
|
|
if len(ues) < situation_etud_cursus.nb_max_ue:
|
|
|
|
H.append(
|
|
|
|
f"""<td colspan="{situation_etud_cursus.nb_max_ue - len(ues)}"></td>"""
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
# indique le semestre compensé par celui ci:
|
|
|
|
if decision_sem and decision_sem["compense_formsemestre_id"]:
|
|
|
|
csem = sco_formsemestre.get_formsemestre(
|
2021-08-19 10:28:35 +02:00
|
|
|
decision_sem["compense_formsemestre_id"]
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-11-27 19:07:42 +01:00
|
|
|
H.append(f"""<td><em>compense S{csem["semestre_id"]}</em></td>""")
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
H.append("<td></td>")
|
|
|
|
if with_links:
|
|
|
|
H.append("<td></td>")
|
|
|
|
H.append("</tr>")
|
|
|
|
# 2eme ligne: notes
|
2024-06-07 17:58:02 +02:00
|
|
|
H.append(f"""<tr class="{class_sem} rcp_l2 sem_{formsemestre.id}">""")
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2023-10-19 21:07:03 +02:00
|
|
|
f"""<td class="rcp_type_sem"
|
2022-11-27 19:07:42 +01:00
|
|
|
style="background-color:{bgcolor};"> </td>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
if is_prev:
|
|
|
|
default_sem_info = '<span class="fontred">[sem. précédent]</span>'
|
|
|
|
else:
|
|
|
|
default_sem_info = ""
|
2024-06-07 17:58:02 +02:00
|
|
|
if not formsemestre.etat: # locked
|
2021-02-04 20:02:44 +01:00
|
|
|
lockicon = scu.icontag("lock32_img", title="verrouillé", border="0")
|
2020-09-26 16:19:37 +02:00
|
|
|
default_sem_info += lockicon
|
2024-06-07 17:58:02 +02:00
|
|
|
if (
|
|
|
|
formsemestre.formation.formation_code
|
|
|
|
!= situation_etud_cursus.formation.formation_code
|
|
|
|
):
|
|
|
|
default_sem_info += (
|
|
|
|
f"""Autre formation: {formsemestre.formation.formation_code}"""
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2024-08-24 08:06:46 +02:00
|
|
|
f"""<td class="datefin"><a href="{url_status}">{formsemestre.mois_fin()}</a></td>
|
|
|
|
<td class="sem_info">{sem_info.get(formsemestre.id, default_sem_info)}</td>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
# Moy Gen (sous le code decision)
|
|
|
|
H.append(
|
2022-11-27 19:07:42 +01:00
|
|
|
f"""<td class="rcp_moy">{scu.fmt_note(nt.get_etud_moy_gen(etudid))}</td>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
# Absences (nb d'abs non just. dans ce semestre)
|
2024-06-07 17:58:02 +02:00
|
|
|
nbabsnj = sco_assiduites.formsemestre_get_assiduites_count(
|
|
|
|
etudid, formsemestre
|
|
|
|
)[0]
|
2024-03-01 12:40:05 +01:00
|
|
|
H.append(f"""<td class="rcp_abs">{nbabsnj}</td>""")
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
# UEs
|
|
|
|
for ue in ues:
|
2022-11-27 19:07:42 +01:00
|
|
|
if decisions_ue and ue.id in decisions_ue:
|
|
|
|
code = decisions_ue[ue.id]["code"]
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
|
|
|
code = ""
|
2022-11-27 19:07:42 +01:00
|
|
|
ue_status = etud_ue_status[ue.id]
|
2022-02-12 22:57:46 +01:00
|
|
|
moy_ue = ue_status["moy"] if ue_status else ""
|
2020-09-26 16:19:37 +02:00
|
|
|
explanation_ue = [] # list of strings
|
|
|
|
if code == ADM:
|
|
|
|
class_ue = "ue_adm"
|
|
|
|
elif code == CMP:
|
|
|
|
class_ue = "ue_cmp"
|
|
|
|
else:
|
|
|
|
class_ue = "ue"
|
2022-02-12 22:57:46 +01:00
|
|
|
if ue_status and ue_status["is_external"]: # validation externe
|
2020-09-26 16:19:37 +02:00
|
|
|
explanation_ue.append("UE externe.")
|
2022-07-19 10:28:22 +02:00
|
|
|
|
2022-02-12 22:57:46 +01:00
|
|
|
if ue_status and ue_status["is_capitalized"]:
|
2020-09-26 16:19:37 +02:00
|
|
|
class_ue += " ue_capitalized"
|
|
|
|
explanation_ue.append(
|
2022-11-27 19:07:42 +01:00
|
|
|
f"""Capitalisée le {ue_status["event_date"] or "?"}."""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2023-06-23 17:51:17 +02:00
|
|
|
# Dispense BUT ?
|
|
|
|
if (etudid, ue.id) in nt.dispense_ues:
|
2024-02-13 13:55:16 +01:00
|
|
|
moy_ue_txt = (
|
|
|
|
"❎" if (ue_status and ue_status["is_capitalized"]) else "⭕"
|
|
|
|
)
|
2023-06-23 17:51:17 +02:00
|
|
|
explanation_ue.append("non inscrit (dispense)")
|
|
|
|
else:
|
|
|
|
moy_ue_txt = scu.fmt_note(moy_ue)
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-11-27 19:07:42 +01:00
|
|
|
f"""<td class="{class_ue}" title="{
|
|
|
|
" ".join(explanation_ue)
|
2023-06-23 17:51:17 +02:00
|
|
|
}">{moy_ue_txt}</td>"""
|
|
|
|
)
|
|
|
|
if len(ues) < situation_etud_cursus.nb_max_ue:
|
|
|
|
H.append(
|
|
|
|
f"""<td colspan="{situation_etud_cursus.nb_max_ue - len(ues)}"></td>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
H.append("<td></td>")
|
|
|
|
if with_links:
|
|
|
|
H.append(
|
2024-06-07 17:58:02 +02:00
|
|
|
f"""<td><a class="stdlink" href="{
|
|
|
|
url_for("notes.formsemestre_validation_etud_form", scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id, etudid=etudid
|
|
|
|
)}">modifier</a></td>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
H.append("</tr>")
|
|
|
|
# 3eme ligne: ECTS
|
|
|
|
if (
|
2024-06-07 17:58:02 +02:00
|
|
|
sco_preferences.get_preference("bul_show_ects", formsemestre.id)
|
2020-09-26 16:19:37 +02:00
|
|
|
or nt.parcours.ECTS_ONLY
|
|
|
|
):
|
2022-07-19 10:28:22 +02:00
|
|
|
etud_ects_infos = nt.get_etud_ects_pot(etudid) # ECTS potentiels
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2024-06-07 17:58:02 +02:00
|
|
|
f"""<tr class="{class_sem} rcp_l2 sem_{formsemestre.id}">
|
2022-07-19 10:28:22 +02:00
|
|
|
<td class="rcp_type_sem" style="background-color:{bgcolor};"> </td>
|
|
|
|
<td></td>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-07-19 10:28:22 +02:00
|
|
|
# Total ECTS (affiché sous la moyenne générale)
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
2022-07-19 10:28:22 +02:00
|
|
|
f"""<td class="sem_ects_tit"><a title="crédit acquis">ECTS:</a></td>
|
2024-06-07 17:58:02 +02:00
|
|
|
<td class="sem_ects">{
|
2024-06-26 22:24:10 +02:00
|
|
|
pv.get("sum_ects",0):2.3g} / {etud_ects_infos["ects_total"]:2.3g}
|
2024-06-14 07:16:04 +02:00
|
|
|
</td>
|
2022-07-19 10:28:22 +02:00
|
|
|
<td class="rcp_abs"></td>
|
|
|
|
"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
# ECTS validables dans chaque UE
|
|
|
|
for ue in ues:
|
2022-11-27 19:07:42 +01:00
|
|
|
ue_status = nt.get_etud_ue_status(etudid, ue.id)
|
2022-07-19 10:28:22 +02:00
|
|
|
if ue_status:
|
|
|
|
ects = ue_status["ects"]
|
|
|
|
ects_pot = ue_status["ects_pot"]
|
|
|
|
H.append(
|
2022-11-27 19:07:42 +01:00
|
|
|
f"""<td class="ue"
|
2024-06-26 22:24:10 +02:00
|
|
|
title="{ects:2.3g}/{ects_pot:2.3g} ECTS">{ects:2.3g}</td>"""
|
2022-07-19 10:28:22 +02:00
|
|
|
)
|
|
|
|
else:
|
2022-11-27 19:07:42 +01:00
|
|
|
H.append("""<td class="ue"></td>""")
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append("<td></td></tr>")
|
|
|
|
|
|
|
|
H.append("</table>")
|
|
|
|
return "\n".join(H)
|
|
|
|
|
|
|
|
|
2021-08-21 00:24:51 +02:00
|
|
|
def form_decision_manuelle(Se, formsemestre_id, etudid, desturl="", sortcol=None):
|
2021-01-01 18:40:47 +01:00
|
|
|
"""Formulaire pour saisie décision manuelle"""
|
2020-09-26 16:19:37 +02:00
|
|
|
H = [
|
|
|
|
"""
|
|
|
|
<script type="text/javascript">
|
|
|
|
function IsEmpty(aTextField) {
|
|
|
|
if ((aTextField.value.length==0) || (aTextField.value==null)) {
|
|
|
|
return true;
|
|
|
|
} else { return false; }
|
|
|
|
}
|
|
|
|
function check_sfv_form() {
|
|
|
|
if (IsEmpty(document.forms.formvalidmanu.code_etat)) {
|
|
|
|
alert('Choisir un code semestre !');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
</script>
|
2023-10-19 21:07:03 +02:00
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
<form method="get" action="formsemestre_validation_etud_manu" name="formvalidmanu" id="formvalidmanu" class="sfv_decisions sfv_decisions_manuelles" onsubmit="return check_sfv_form()">
|
|
|
|
<input type="hidden" name="etudid" value="%s"/>
|
|
|
|
<input type="hidden" name="formsemestre_id" value="%s"/>
|
|
|
|
"""
|
|
|
|
% (etudid, formsemestre_id)
|
|
|
|
]
|
|
|
|
if desturl:
|
|
|
|
H.append('<input type="hidden" name="desturl" value="%s"/>' % desturl)
|
|
|
|
if sortcol:
|
|
|
|
H.append('<input type="hidden" name="sortcol" value="%s"/>' % sortcol)
|
|
|
|
|
|
|
|
H.append(
|
|
|
|
'<h3 class="sfv">Décisions manuelles : <em>(vérifiez bien votre choix !)</em></h3><table>'
|
|
|
|
)
|
|
|
|
|
|
|
|
# Choix code semestre:
|
2023-02-12 13:36:47 +01:00
|
|
|
codes = sorted(codes_cursus.CODES_JURY_SEM)
|
2023-01-23 11:38:47 +01:00
|
|
|
# fortuitement, cet ordre convient bien !
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
H.append(
|
|
|
|
'<tr><td>Code semestre: </td><td><select name="code_etat"><option value="" selected>Choisir...</option>'
|
|
|
|
)
|
|
|
|
for cod in codes:
|
|
|
|
if cod in Se.parcours.UNUSED_CODES:
|
|
|
|
continue
|
|
|
|
if cod != ADC:
|
|
|
|
H.append(
|
|
|
|
'<option value="%s">%s (code %s)</option>'
|
2023-02-12 13:36:47 +01:00
|
|
|
% (cod, codes_cursus.CODES_EXPL[cod], cod)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2021-08-11 00:36:07 +02:00
|
|
|
elif Se.sem["gestion_compensation"]:
|
2020-09-26 16:19:37 +02:00
|
|
|
# traitement spécial pour ADC (compensation)
|
|
|
|
# ne propose que les semestres avec lesquels on peut compenser
|
|
|
|
# le code transmis est ADC_formsemestre_id
|
|
|
|
# on propose aussi une compensation sans utiliser de semestre, pour les cas ou le semestre
|
|
|
|
# précédent n'est pas géré dans ScoDoc (code ADC_)
|
|
|
|
# log(str(Se.sems))
|
|
|
|
for sem in Se.sems:
|
2024-06-07 17:58:02 +02:00
|
|
|
if sem["formsemestre_id"] in Se.can_compensate:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
|
|
|
'<option value="%s_%s">Admis par compensation avec S%s (%s)</option>'
|
|
|
|
% (
|
|
|
|
cod,
|
|
|
|
sem["formsemestre_id"],
|
|
|
|
sem["semestre_id"],
|
|
|
|
sem["date_debut"],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if Se.could_be_compensated():
|
|
|
|
H.append(
|
|
|
|
'<option value="ADC_">Admis par compensation (avec un semestre hors ScoDoc)</option>'
|
|
|
|
)
|
|
|
|
H.append("</select></td></tr>")
|
|
|
|
|
|
|
|
# Choix code semestre precedent:
|
2024-06-07 17:58:02 +02:00
|
|
|
if Se.prev_formsemestre:
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append(
|
|
|
|
'<tr><td>Code semestre précédent: </td><td><select name="new_code_prev"><option value="">Choisir une décision...</option>'
|
|
|
|
)
|
|
|
|
for cod in codes:
|
|
|
|
if cod == ADC: # ne propose pas ce choix
|
|
|
|
continue
|
|
|
|
if Se.prev_decision and cod == Se.prev_decision["code"]:
|
|
|
|
sel = "selected"
|
|
|
|
else:
|
|
|
|
sel = ""
|
|
|
|
H.append(
|
|
|
|
'<option value="%s" %s>%s (code %s)</option>'
|
2023-02-12 13:36:47 +01:00
|
|
|
% (cod, sel, codes_cursus.CODES_EXPL[cod], cod)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
H.append("</select></td></tr>")
|
|
|
|
|
|
|
|
# Choix code devenir
|
2023-02-12 13:36:47 +01:00
|
|
|
codes = list(codes_cursus.DEVENIR_EXPL.keys())
|
2020-09-26 16:19:37 +02:00
|
|
|
codes.sort() # fortuitement, cet ordre convient aussi bien !
|
|
|
|
|
|
|
|
if Se.sem["semestre_id"] == -1:
|
2023-02-12 13:36:47 +01:00
|
|
|
allowed_codes = codes_cursus.DEVENIRS_MONO
|
2020-09-26 16:19:37 +02:00
|
|
|
else:
|
2023-02-12 13:36:47 +01:00
|
|
|
allowed_codes = set(codes_cursus.DEVENIRS_STD)
|
2020-09-26 16:19:37 +02:00
|
|
|
# semestres decales ?
|
2021-08-11 00:36:07 +02:00
|
|
|
if Se.sem["gestion_semestrielle"]:
|
2023-02-12 13:36:47 +01:00
|
|
|
allowed_codes = allowed_codes.union(codes_cursus.DEVENIRS_DEC)
|
2020-09-26 16:19:37 +02:00
|
|
|
# n'autorise les codes NEXT2 que si semestres décalés et s'il ne manque qu'un semestre avant le n+2
|
|
|
|
if Se.can_jump_to_next2():
|
2023-02-12 13:36:47 +01:00
|
|
|
allowed_codes = allowed_codes.union(codes_cursus.DEVENIRS_NEXT2)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
H.append(
|
|
|
|
'<tr><td>Devenir: </td><td><select name="devenir"><option value="" selected>Choisir...</option>'
|
|
|
|
)
|
|
|
|
for cod in codes:
|
|
|
|
if cod in allowed_codes: # or Se.sem['gestion_semestrielle'] == '1'
|
|
|
|
H.append('<option value="%s">%s</option>' % (cod, Se.explique_devenir(cod)))
|
|
|
|
H.append("</select></td></tr>")
|
|
|
|
|
|
|
|
H.append(
|
|
|
|
'<tr><td><input type="checkbox" name="assidu" checked="checked">assidu</input></td></tr>'
|
|
|
|
)
|
|
|
|
|
|
|
|
H.append(
|
|
|
|
"""</table>
|
|
|
|
<input type="submit" name="formvalidmanu_submit" value="Valider décision manuelle"/>
|
2021-05-11 11:48:32 +02:00
|
|
|
<span style="padding-left: 5em;"><a href="formsemestre_validation_suppress_etud?etudid=%s&formsemestre_id=%s" class="stdlink">Supprimer décision existante</a></span>
|
2020-09-26 16:19:37 +02:00
|
|
|
</form>
|
|
|
|
"""
|
|
|
|
% (etudid, formsemestre_id)
|
|
|
|
)
|
|
|
|
return "\n".join(H)
|
|
|
|
|
|
|
|
|
|
|
|
# -----------
|
2024-08-16 01:11:06 +02:00
|
|
|
def formsemestre_validation_auto(formsemestre_id: int):
|
|
|
|
"Formulaire saisie automatisée des décisions d'un semestre"
|
|
|
|
return render_template(
|
|
|
|
"sco_page.j2",
|
|
|
|
title="Saisie automatique des décisions",
|
|
|
|
content=f"""
|
|
|
|
<h2>Saisie automatique des décisions du semestre</h2>
|
2020-09-26 16:19:37 +02:00
|
|
|
<ul>
|
|
|
|
<li>Seuls les étudiants qui obtiennent le semestre seront affectés (code ADM, moyenne générale et
|
|
|
|
toutes les barres, semestre précédent validé);</li>
|
|
|
|
<li>le semestre précédent, s'il y en a un, doit avoir été validé;</li>
|
|
|
|
<li>les décisions du semestre précédent ne seront pas modifiées;</li>
|
|
|
|
<li>l'assiduité n'est <b>pas</b> prise en compte;</li>
|
|
|
|
<li>les étudiants avec des notes en attente sont ignorés.</li>
|
|
|
|
</ul>
|
|
|
|
<p>Il est donc vivement conseillé de relire soigneusement les décisions à l'issue
|
|
|
|
de cette procédure !</p>
|
|
|
|
<form action="do_formsemestre_validation_auto">
|
2022-07-11 18:28:58 +02:00
|
|
|
<input type="hidden" name="formsemestre_id" value="{formsemestre_id}"/>
|
2020-09-26 16:19:37 +02:00
|
|
|
<input type="submit" value="Calculer automatiquement ces décisions"/>
|
|
|
|
<p><em>Le calcul prend quelques minutes, soyez patients !</em></p>
|
|
|
|
</form>
|
2022-07-11 18:28:58 +02:00
|
|
|
""",
|
2024-08-16 01:11:06 +02:00
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2021-09-27 10:20:10 +02:00
|
|
|
def do_formsemestre_validation_auto(formsemestre_id):
|
2020-09-26 16:19:37 +02:00
|
|
|
"Saisie automatisee des decisions d'un semestre"
|
2021-08-19 10:28:35 +02:00
|
|
|
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
next_semestre_id = sem["semestre_id"] + 1
|
2023-03-20 11:17:38 +01:00
|
|
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
2022-02-12 22:57:46 +01:00
|
|
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
2020-09-26 16:19:37 +02:00
|
|
|
etudids = nt.get_etudids()
|
|
|
|
nb_valid = 0
|
|
|
|
conflicts = [] # liste des etudiants avec decision differente déjà saisie
|
2022-07-11 18:28:58 +02:00
|
|
|
with sco_cache.DeferredSemCacheManager():
|
|
|
|
for etudid in etudids:
|
2024-06-07 17:58:02 +02:00
|
|
|
etud = Identite.get_etud(etudid)
|
2022-07-11 18:28:58 +02:00
|
|
|
Se = sco_cursus.get_situation_etud_cursus(etud, formsemestre_id)
|
|
|
|
ins = sco_formsemestre_inscriptions.do_formsemestre_inscription_list(
|
|
|
|
{"etudid": etudid, "formsemestre_id": formsemestre_id}
|
|
|
|
)[0]
|
|
|
|
|
|
|
|
# Conditions pour validation automatique:
|
2022-09-30 22:43:39 +02:00
|
|
|
if ins["etat"] == scu.INSCRIT and (
|
2022-07-11 18:28:58 +02:00
|
|
|
(
|
2024-06-07 17:58:02 +02:00
|
|
|
(not Se.prev_formsemestre)
|
2022-07-11 18:28:58 +02:00
|
|
|
or (
|
|
|
|
Se.prev_decision and Se.prev_decision["code"] in (ADM, ADC, ADJ)
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-07-11 18:28:58 +02:00
|
|
|
and Se.barre_moy_ok
|
|
|
|
and Se.barres_ue_ok
|
|
|
|
and not etud_has_notes_attente(etudid, formsemestre_id)
|
|
|
|
):
|
|
|
|
# check: s'il existe une decision ou autorisation et qu'elles sont differentes,
|
|
|
|
# warning (et ne fait rien)
|
|
|
|
decision_sem = nt.get_etud_decision_sem(etudid)
|
|
|
|
ok = True
|
|
|
|
if decision_sem and decision_sem["code"] != ADM:
|
|
|
|
ok = False
|
|
|
|
conflicts.append(etud)
|
|
|
|
autorisations = ScolarAutorisationInscription.query.filter_by(
|
|
|
|
etudid=etudid, origin_formsemestre_id=formsemestre_id
|
|
|
|
).all()
|
|
|
|
if len(autorisations) != 0:
|
|
|
|
if (
|
|
|
|
len(autorisations) > 1
|
|
|
|
or autorisations[0].semestre_id != next_semestre_id
|
|
|
|
):
|
|
|
|
if ok:
|
|
|
|
conflicts.append(etud)
|
|
|
|
ok = False
|
|
|
|
|
|
|
|
# ok, valide !
|
|
|
|
if ok:
|
|
|
|
formsemestre_validation_etud_manu(
|
|
|
|
formsemestre_id,
|
|
|
|
etudid,
|
|
|
|
code_etat=ADM,
|
|
|
|
devenir="NEXT",
|
|
|
|
assidu=True,
|
|
|
|
redirect=False,
|
|
|
|
)
|
|
|
|
nb_valid += 1
|
2020-09-26 16:19:37 +02:00
|
|
|
log(
|
2023-06-23 10:37:32 +02:00
|
|
|
f"do_formsemestre_validation_auto: {nb_valid} validations, {len(conflicts)} conflicts"
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2023-06-23 10:37:32 +02:00
|
|
|
ScolarNews.add(
|
|
|
|
typ=ScolarNews.NEWS_JURY,
|
|
|
|
obj=formsemestre.id,
|
|
|
|
text=f"""Calcul jury automatique du semestre {formsemestre.html_link_status()
|
|
|
|
} ({nb_valid} décisions)""",
|
|
|
|
url=url_for(
|
|
|
|
"notes.formsemestre_status",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
),
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2023-06-23 10:37:32 +02:00
|
|
|
H = [
|
2024-08-24 18:26:51 +02:00
|
|
|
f"""
|
2023-06-23 10:37:32 +02:00
|
|
|
<h2>Saisie automatique des décisions du semestre {formsemestre.titre_annee()}</h2>
|
|
|
|
<p>Opération effectuée.</p>
|
|
|
|
<p>{nb_valid} étudiants validés sur {len(etudids)}</p>
|
|
|
|
"""
|
|
|
|
]
|
2020-09-26 16:19:37 +02:00
|
|
|
if conflicts:
|
|
|
|
H.append(
|
2023-10-19 21:07:03 +02:00
|
|
|
f"""<p><b>Attention:</b> {len(conflicts)} étudiants non modifiés
|
2022-04-07 23:31:08 +02:00
|
|
|
car décisions différentes déja saisies :
|
|
|
|
<ul>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
for etud in conflicts:
|
|
|
|
H.append(
|
2022-04-07 23:31:08 +02:00
|
|
|
f"""<li><a href="{
|
|
|
|
url_for('notes.formsemestre_validation_etud_form',
|
|
|
|
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre_id,
|
2024-06-07 17:58:02 +02:00
|
|
|
etudid=etud.id, check=1)
|
2024-07-08 23:13:45 +02:00
|
|
|
}">{etud.nom_prenom()}</li>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
H.append("</ul>")
|
|
|
|
H.append(
|
2022-04-07 23:31:08 +02:00
|
|
|
f"""<a href="{url_for('notes.formsemestre_recapcomplet',
|
2022-06-29 16:30:01 +02:00
|
|
|
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre_id, mode_jury=1)
|
2022-04-07 23:31:08 +02:00
|
|
|
}">continuer</a>"""
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-08-24 18:26:51 +02:00
|
|
|
|
|
|
|
return render_template(
|
|
|
|
"sco_page.j2", title="Saisie automatique", content="\n".join(H)
|
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
|
2021-08-21 00:24:51 +02:00
|
|
|
def formsemestre_validation_suppress_etud(formsemestre_id, etudid):
|
2022-07-06 00:05:14 +02:00
|
|
|
"""Suppression des décisions de jury pour un étudiant/formsemestre.
|
|
|
|
Efface toutes les décisions enregistrées concernant ce formsemestre et cet étudiant:
|
|
|
|
code semestre, UEs, autorisations d'inscription
|
|
|
|
"""
|
|
|
|
log(f"formsemestre_validation_suppress_etud( {formsemestre_id}, {etudid})")
|
|
|
|
|
|
|
|
# Validations jury classiques (semestres, UEs, autorisations)
|
|
|
|
for v in ScolarFormSemestreValidation.query.filter_by(
|
|
|
|
etudid=etudid, formsemestre_id=formsemestre_id
|
|
|
|
):
|
|
|
|
db.session.delete(v)
|
|
|
|
for v in ScolarAutorisationInscription.query.filter_by(
|
|
|
|
etudid=etudid, origin_formsemestre_id=formsemestre_id
|
|
|
|
):
|
|
|
|
db.session.delete(v)
|
|
|
|
# Validations jury spécifiques BUT
|
|
|
|
for v in ApcValidationRCUE.query.filter_by(
|
|
|
|
etudid=etudid, formsemestre_id=formsemestre_id
|
|
|
|
):
|
|
|
|
db.session.delete(v)
|
|
|
|
for v in ApcValidationAnnee.query.filter_by(
|
|
|
|
etudid=etudid, formsemestre_id=formsemestre_id
|
|
|
|
):
|
|
|
|
db.session.delete(v)
|
|
|
|
|
|
|
|
db.session.commit()
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2021-08-19 10:28:35 +02:00
|
|
|
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
_invalidate_etud_formation_caches(
|
2021-08-21 00:24:51 +02:00
|
|
|
etudid, sem["formation_id"]
|
2020-09-26 16:19:37 +02:00
|
|
|
) # > suppr. decision jury (peut affecter de plusieurs semestres utilisant UE capitalisée)
|
|
|
|
|
|
|
|
|
2023-06-25 11:49:11 +02:00
|
|
|
def formsemestre_validate_previous_ue(formsemestre: FormSemestre, etud: Identite):
|
2021-01-01 18:40:47 +01:00
|
|
|
"""Form. saisie UE validée hors ScoDoc
|
2020-09-26 16:19:37 +02:00
|
|
|
(pour étudiants arrivant avec un UE antérieurement validée).
|
|
|
|
"""
|
2023-06-25 11:49:11 +02:00
|
|
|
formation: Formation = formsemestre.formation
|
|
|
|
|
|
|
|
# Toutes les UEs non bonus de cette formation sont présentées
|
|
|
|
# avec indice de semestre <= semestre courant ou NULL
|
|
|
|
ues = formation.ues.filter(
|
|
|
|
UniteEns.type != UE_SPORT,
|
|
|
|
db.or_(
|
|
|
|
UniteEns.semestre_idx == None,
|
|
|
|
UniteEns.semestre_idx <= formsemestre.semestre_id,
|
2020-09-26 16:19:37 +02:00
|
|
|
),
|
2023-06-25 11:49:11 +02:00
|
|
|
).order_by(UniteEns.semestre_idx, UniteEns.numero)
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-06-25 11:49:11 +02:00
|
|
|
ue_names = ["Choisir..."] + [
|
|
|
|
f"""{('S'+str(ue.semestre_idx)+' : ') if ue.semestre_idx is not None else ''
|
2024-02-13 13:55:16 +01:00
|
|
|
}{ue.acronyme} {ue.titre or ''} ({ue.ue_code or ""})"""
|
2023-06-25 11:49:11 +02:00
|
|
|
for ue in ues
|
|
|
|
]
|
2023-02-18 00:13:00 +01:00
|
|
|
ue_ids = [""] + [ue.id for ue in ues]
|
2023-06-25 11:49:11 +02:00
|
|
|
form_descr = [
|
|
|
|
("etudid", {"input_type": "hidden"}),
|
|
|
|
("formsemestre_id", {"input_type": "hidden"}),
|
2020-09-26 16:19:37 +02:00
|
|
|
(
|
2023-06-25 11:49:11 +02:00
|
|
|
"ue_id",
|
|
|
|
{
|
|
|
|
"input_type": "menu",
|
|
|
|
"title": "Unité d'Enseignement (UE)",
|
|
|
|
"allow_null": False,
|
|
|
|
"allowed_values": ue_ids,
|
|
|
|
"labels": ue_names,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
]
|
|
|
|
if not formation.is_apc():
|
|
|
|
form_descr.append(
|
2020-09-26 16:19:37 +02:00
|
|
|
(
|
|
|
|
"semestre_id",
|
|
|
|
{
|
|
|
|
"input_type": "menu",
|
|
|
|
"title": "Indice du semestre",
|
|
|
|
"explanation": "Facultatif: indice du semestre dans la formation",
|
|
|
|
"allow_null": True,
|
2022-02-06 16:09:17 +01:00
|
|
|
"allowed_values": [""] + [x for x in range(11)],
|
2021-07-09 17:47:06 +02:00
|
|
|
"labels": ["-"] + list(range(11)),
|
2020-09-26 16:19:37 +02:00
|
|
|
},
|
2023-06-25 11:49:11 +02:00
|
|
|
)
|
|
|
|
)
|
2023-06-30 17:26:41 +02:00
|
|
|
ue_codes = sorted(codes_cursus.CODES_JURY_UE)
|
2023-06-25 11:49:11 +02:00
|
|
|
form_descr += [
|
|
|
|
(
|
|
|
|
"date",
|
|
|
|
{
|
|
|
|
"input_type": "date",
|
|
|
|
"size": 9,
|
|
|
|
"explanation": "j/m/a",
|
2024-04-02 23:37:23 +02:00
|
|
|
"default": time.strftime(scu.DATE_FMT),
|
2023-06-25 11:49:11 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"moy_ue",
|
|
|
|
{
|
|
|
|
"type": "float",
|
|
|
|
"allow_null": False,
|
|
|
|
"min_value": 0,
|
|
|
|
"max_value": 20,
|
|
|
|
"title": "Moyenne (/20) obtenue dans cette UE:",
|
|
|
|
},
|
2020-09-26 16:19:37 +02:00
|
|
|
),
|
2023-06-30 17:26:41 +02:00
|
|
|
(
|
|
|
|
"code_jury",
|
|
|
|
{
|
|
|
|
"input_type": "menu",
|
|
|
|
"title": "Code jury",
|
|
|
|
"explanation": " code donné par le jury (ADM si validée normalement)",
|
|
|
|
"allow_null": True,
|
|
|
|
"allowed_values": [""] + ue_codes,
|
|
|
|
"labels": ["-"] + ue_codes,
|
|
|
|
"default": ADM,
|
|
|
|
},
|
|
|
|
),
|
2023-06-25 11:49:11 +02:00
|
|
|
]
|
|
|
|
tf = TrivialFormulator(
|
|
|
|
request.base_url,
|
|
|
|
scu.get_request_args(),
|
|
|
|
form_descr,
|
|
|
|
cancelbutton="Revenir au bulletin",
|
2020-09-26 16:19:37 +02:00
|
|
|
submitlabel="Enregistrer validation d'UE",
|
|
|
|
)
|
|
|
|
if tf[0] == 0:
|
2024-08-24 18:26:51 +02:00
|
|
|
return render_template(
|
|
|
|
"sco_page_dept.j2",
|
|
|
|
title="Validation UE antérieure",
|
|
|
|
javascripts=["js/validate_previous_ue.js"],
|
|
|
|
cssstyles=["css/jury_delete_manual.css"],
|
|
|
|
etudid=etud.id,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
content=f"""
|
2023-06-25 11:49:11 +02:00
|
|
|
<h2 class="formsemestre">Gestion des validations d'UEs antérieures
|
|
|
|
de {etud.html_link_fiche()}
|
|
|
|
</h2>
|
|
|
|
|
2023-06-30 17:26:41 +02:00
|
|
|
<p class="help">Utiliser cette page pour enregistrer des UEs validées antérieurement,
|
2023-06-25 11:49:11 +02:00
|
|
|
<em>dans un semestre hors ScoDoc</em>.</p>
|
2024-03-20 18:13:19 +01:00
|
|
|
|
|
|
|
<div class="scobox explanation">
|
|
|
|
<p><b>Les UE validées dans ScoDoc sont
|
2023-10-19 21:07:03 +02:00
|
|
|
automatiquement prises en compte</b>.
|
2023-06-30 17:26:41 +02:00
|
|
|
</p>
|
|
|
|
<p>Cette page est surtout utile pour les étudiants ayant
|
2023-10-19 21:07:03 +02:00
|
|
|
suivi un début de cursus dans <b>un autre établissement</b>, ou qui
|
2023-06-30 17:26:41 +02:00
|
|
|
ont suivi une UE à l'étranger ou dans un semestre géré <b>sans ScoDoc</b>.
|
2023-10-19 21:07:03 +02:00
|
|
|
</>
|
|
|
|
<p>Il est aussi nécessaire de valider les UEs antérieures en cas de changement
|
|
|
|
de référentiel de compétence en cours de cursus (par exemple si un étudiant redouble et
|
|
|
|
que le programme change de référentiel entre temps).
|
2023-06-30 17:26:41 +02:00
|
|
|
</p>
|
|
|
|
<p>Pour les semestres précédents gérés avec ScoDoc, passer par la page jury normale.
|
|
|
|
</p>
|
|
|
|
<p>Notez que l'UE est validée, avec enregistrement immédiat de la décision et
|
|
|
|
l'attribution des ECTS si le code jury est validant (ADM).
|
2023-06-25 11:49:11 +02:00
|
|
|
</p>
|
|
|
|
<p>On ne peut valider ici que les UEs du cursus <b>{formation.titre}</b></p>
|
2024-03-20 18:13:19 +01:00
|
|
|
</div>
|
2023-06-25 11:49:11 +02:00
|
|
|
|
2024-07-10 00:53:09 +02:00
|
|
|
{_get_etud_ue_validations_html(etud, formsemestre)}
|
2023-06-25 11:49:11 +02:00
|
|
|
|
2024-03-20 18:13:19 +01:00
|
|
|
<div class="scobox">
|
|
|
|
<div class="scobox-title">
|
2023-06-25 11:49:11 +02:00
|
|
|
Enregistrer une UE antérieure
|
|
|
|
</div>
|
|
|
|
{tf[1]}
|
|
|
|
</div>
|
|
|
|
<div id="ue_list_code" class="sco_box sco_green_bg">
|
|
|
|
<!-- filled by ue_sharing_code -->
|
|
|
|
</div>
|
2024-02-14 21:45:58 +01:00
|
|
|
{check_formation_ues(formation)[0]}
|
2024-08-24 18:26:51 +02:00
|
|
|
""",
|
|
|
|
)
|
2023-06-25 11:49:11 +02:00
|
|
|
|
|
|
|
dest_url = url_for(
|
|
|
|
"notes.formsemestre_validate_previous_ue",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
etudid=etud.id,
|
|
|
|
)
|
|
|
|
if tf[0] == -1:
|
2021-07-31 18:01:10 +02:00
|
|
|
return flask.redirect(
|
2023-02-18 00:13:00 +01:00
|
|
|
url_for(
|
|
|
|
"notes.formsemestre_bulletinetud",
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
2023-06-25 11:49:11 +02:00
|
|
|
formsemestre_id=formsemestre.id,
|
|
|
|
etudid=etud.id,
|
2023-02-18 00:13:00 +01:00
|
|
|
)
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2023-06-25 11:49:11 +02:00
|
|
|
if tf[2].get("semestre_id"):
|
|
|
|
semestre_id = int(tf[2]["semestre_id"])
|
|
|
|
else:
|
|
|
|
semestre_id = None
|
|
|
|
|
2023-06-30 17:26:41 +02:00
|
|
|
if tf[2]["code_jury"] not in CODES_JURY_UE:
|
|
|
|
flash("Code UE invalide")
|
|
|
|
return flask.redirect(dest_url)
|
2023-06-25 11:49:11 +02:00
|
|
|
do_formsemestre_validate_previous_ue(
|
|
|
|
formsemestre,
|
|
|
|
etud.id,
|
|
|
|
tf[2]["ue_id"],
|
|
|
|
tf[2]["moy_ue"],
|
|
|
|
tf[2]["date"],
|
2023-06-30 17:26:41 +02:00
|
|
|
code=tf[2]["code_jury"],
|
2023-06-25 11:49:11 +02:00
|
|
|
semestre_id=semestre_id,
|
|
|
|
)
|
|
|
|
flash("Validation d'UE enregistrée")
|
|
|
|
return flask.redirect(dest_url)
|
|
|
|
|
|
|
|
|
2024-07-10 00:53:09 +02:00
|
|
|
def _get_etud_ue_validations_html(etud: Identite, formsemestre: FormSemestre) -> str:
|
2023-06-25 11:49:11 +02:00
|
|
|
"""HTML listant les validations d'UEs pour cet étudiant dans des formations de même
|
|
|
|
code que celle du formsemestre indiqué.
|
|
|
|
"""
|
2024-09-08 23:52:32 +02:00
|
|
|
validations = get_etud_ue_validations(etud, formsemestre.formation)
|
|
|
|
if not validations:
|
|
|
|
return ""
|
|
|
|
return render_template(
|
|
|
|
"jury/ue_list_etud_validations.j2",
|
|
|
|
edit_mode=True,
|
|
|
|
etud=etud,
|
|
|
|
titre_boite="Validations d'UEs dans cette formation",
|
|
|
|
validations=validations,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def get_etud_ue_validations(
|
|
|
|
etud: Identite, formation: Formation
|
|
|
|
) -> list[ScolarFormSemestreValidation]:
|
|
|
|
"""Retourne les validations d'UEs pour cet étudiant dans des formations de même
|
|
|
|
code que celle indiquée.
|
|
|
|
"""
|
|
|
|
return (
|
2023-06-25 11:49:11 +02:00
|
|
|
ScolarFormSemestreValidation.query.filter_by(etudid=etud.id)
|
|
|
|
.join(UniteEns)
|
|
|
|
.join(Formation)
|
2024-09-08 23:52:32 +02:00
|
|
|
.filter_by(formation_code=formation.formation_code)
|
2023-06-25 11:49:11 +02:00
|
|
|
.order_by(
|
|
|
|
sa.desc(UniteEns.semestre_idx),
|
2024-09-08 23:52:32 +02:00
|
|
|
UniteEns.numero,
|
2023-06-25 11:49:11 +02:00
|
|
|
UniteEns.acronyme,
|
|
|
|
sa.desc(ScolarFormSemestreValidation.event_date),
|
|
|
|
)
|
|
|
|
.all()
|
|
|
|
)
|
|
|
|
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
def do_formsemestre_validate_previous_ue(
|
2023-06-25 11:49:11 +02:00
|
|
|
formsemestre: FormSemestre,
|
2020-09-26 16:19:37 +02:00
|
|
|
etudid,
|
|
|
|
ue_id,
|
|
|
|
moy_ue,
|
|
|
|
date,
|
|
|
|
code=ADM,
|
|
|
|
semestre_id=None,
|
|
|
|
ue_coefficient=None,
|
|
|
|
):
|
|
|
|
"""Enregistre (ou modifie) validation d'UE (obtenue hors ScoDoc).
|
2021-01-01 18:40:47 +01:00
|
|
|
Si le coefficient est spécifié, modifie le coefficient de
|
2020-09-26 16:19:37 +02:00
|
|
|
cette UE (utile seulement pour les semestres extérieurs).
|
|
|
|
"""
|
2022-02-12 22:57:46 +01:00
|
|
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
2022-12-25 01:35:18 +01:00
|
|
|
ue: UniteEns = UniteEns.query.get_or_404(ue_id)
|
2022-02-12 22:57:46 +01:00
|
|
|
|
2021-11-12 22:17:46 +01:00
|
|
|
cnx = ndb.GetDBConnexion()
|
2023-06-30 17:26:41 +02:00
|
|
|
if ue_coefficient is not None:
|
2021-01-17 22:31:28 +01:00
|
|
|
sco_formsemestre.do_formsemestre_uecoef_edit_or_create(
|
2023-06-25 11:49:11 +02:00
|
|
|
cnx, formsemestre.id, ue_id, ue_coefficient
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
else:
|
2023-06-25 11:49:11 +02:00
|
|
|
sco_formsemestre.do_formsemestre_uecoef_delete(cnx, formsemestre.id, ue_id)
|
2022-07-07 16:24:52 +02:00
|
|
|
sco_cursus_dut.do_formsemestre_validate_ue(
|
2020-09-26 16:19:37 +02:00
|
|
|
cnx,
|
|
|
|
nt,
|
2023-06-25 11:49:11 +02:00
|
|
|
formsemestre.id, # "importe" cette UE dans le semestre (new 3/2015)
|
2020-09-26 16:19:37 +02:00
|
|
|
etudid,
|
|
|
|
ue_id,
|
|
|
|
code,
|
|
|
|
moy_ue=moy_ue,
|
|
|
|
date=date,
|
|
|
|
semestre_id=semestre_id,
|
2021-08-11 00:36:07 +02:00
|
|
|
is_external=True,
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
|
|
|
|
2024-07-08 23:13:45 +02:00
|
|
|
Scolog.logdb(
|
2020-09-26 16:19:37 +02:00
|
|
|
method="formsemestre_validate_previous_ue",
|
|
|
|
etudid=etudid,
|
2022-12-25 01:35:18 +01:00
|
|
|
msg=f"Validation UE prec. {ue_id} {ue.acronyme}: {code}",
|
2024-07-08 23:13:45 +02:00
|
|
|
commit=True,
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2022-12-25 01:35:18 +01:00
|
|
|
_invalidate_etud_formation_caches(etudid, formsemestre.formation_id)
|
2020-09-26 16:19:37 +02:00
|
|
|
cnx.commit()
|
|
|
|
|
|
|
|
|
2021-08-21 00:24:51 +02:00
|
|
|
def _invalidate_etud_formation_caches(etudid, formation_id):
|
2020-09-26 16:19:37 +02:00
|
|
|
"Invalide tous les semestres de cette formation où l'etudiant est inscrit..."
|
2021-02-03 22:00:41 +01:00
|
|
|
r = ndb.SimpleDictFetch(
|
2021-08-08 17:38:46 +02:00
|
|
|
"""SELECT sem.id
|
2020-09-26 16:19:37 +02:00
|
|
|
FROM notes_formsemestre sem, notes_formsemestre_inscription i
|
|
|
|
WHERE sem.formation_id = %(formation_id)s
|
2021-08-08 17:38:46 +02:00
|
|
|
AND i.formsemestre_id = sem.id
|
2020-09-26 16:19:37 +02:00
|
|
|
AND i.etudid = %(etudid)s
|
|
|
|
""",
|
|
|
|
{"etudid": etudid, "formation_id": formation_id},
|
|
|
|
)
|
2021-08-08 17:38:46 +02:00
|
|
|
for fsid in [s["id"] for s in r]:
|
2021-07-19 19:53:01 +02:00
|
|
|
sco_cache.invalidate_formsemestre(
|
|
|
|
formsemestre_id=fsid
|
2020-09-26 16:19:37 +02:00
|
|
|
) # > modif decision UE (inval tous semestres avec cet etudiant, ok mais conservatif)
|
|
|
|
|
|
|
|
|
2024-02-14 21:45:58 +01:00
|
|
|
def check_formation_ues(formation: Formation) -> tuple[str, dict[int, list[UniteEns]]]:
|
2020-09-26 16:19:37 +02:00
|
|
|
"""Verifie que les UE d'une formation sont chacune utilisée dans un seul semestre_id
|
|
|
|
Si ce n'est pas le cas, c'est probablement (mais pas forcément) une erreur de
|
|
|
|
définition du programme: cette fonction retourne un bout de HTML
|
|
|
|
à afficher pour prévenir l'utilisateur, ou '' si tout est ok.
|
|
|
|
"""
|
|
|
|
ue_multiples = {} # { ue_id : [ liste des formsemestre ] }
|
2024-02-14 21:45:58 +01:00
|
|
|
for ue in formation.ues:
|
2020-09-26 16:19:37 +02:00
|
|
|
# formsemestres utilisant cette ue ?
|
2021-02-03 22:00:41 +01:00
|
|
|
sems = ndb.SimpleDictFetch(
|
2022-02-19 16:16:52 +01:00
|
|
|
"""SELECT DISTINCT sem.id AS formsemestre_id, sem.*
|
2020-09-26 16:19:37 +02:00
|
|
|
FROM notes_formsemestre sem, notes_modules mod, notes_moduleimpl mi
|
|
|
|
WHERE sem.formation_id = %(formation_id)s
|
2021-08-08 17:38:46 +02:00
|
|
|
AND mod.id = mi.module_id
|
|
|
|
AND mi.formsemestre_id = sem.id
|
|
|
|
AND mod.ue_id = %(ue_id)s
|
|
|
|
""",
|
2024-02-14 21:45:58 +01:00
|
|
|
{"ue_id": ue.id, "formation_id": formation.id},
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-02-14 21:45:58 +01:00
|
|
|
semestre_ids = {x["semestre_id"] for x in sems}
|
2020-09-26 16:19:37 +02:00
|
|
|
if (
|
|
|
|
len(semestre_ids) > 1
|
|
|
|
): # plusieurs semestres d'indices differents dans le cursus
|
2024-02-22 16:50:25 +01:00
|
|
|
ue_multiples[ue.id] = sems
|
2020-09-26 16:19:37 +02:00
|
|
|
|
|
|
|
if not ue_multiples:
|
|
|
|
return "", {}
|
|
|
|
# Genere message HTML:
|
|
|
|
H = [
|
2022-02-19 16:16:52 +01:00
|
|
|
"""<div class="ue_warning"><span>Attention:</span> les UE suivantes de cette formation
|
2020-09-26 16:19:37 +02:00
|
|
|
sont utilisées dans des
|
2022-10-02 23:43:29 +02:00
|
|
|
semestres de rangs différents (eg S1 et S3). <br>Cela peut engendrer des problèmes pour
|
2022-02-19 16:16:52 +01:00
|
|
|
la capitalisation des UE. Il serait préférable d'essayer de rectifier cette situation:
|
|
|
|
soit modifier le programme de la formation (définir des UE dans chaque semestre),
|
2020-09-26 16:19:37 +02:00
|
|
|
soit veiller à saisir le bon indice de semestre dans le menu lors de la validation d'une
|
|
|
|
UE extérieure.
|
|
|
|
<ul>
|
|
|
|
"""
|
|
|
|
]
|
2024-02-14 21:45:58 +01:00
|
|
|
for ue in formation.ues:
|
|
|
|
if ue.id in ue_multiples:
|
2020-09-26 16:19:37 +02:00
|
|
|
sems = [
|
2021-08-19 10:28:35 +02:00
|
|
|
sco_formsemestre.get_formsemestre(x["formsemestre_id"])
|
2024-02-14 21:45:58 +01:00
|
|
|
for x in ue_multiples[ue.id]
|
2020-09-26 16:19:37 +02:00
|
|
|
]
|
|
|
|
slist = ", ".join(
|
2022-02-19 16:16:52 +01:00
|
|
|
[
|
2024-02-22 16:50:25 +01:00
|
|
|
f"""{s['titreannee']
|
|
|
|
} (<em>semestre <b class="fontred">{s['semestre_id']}</b></em>)"""
|
2022-02-19 16:16:52 +01:00
|
|
|
for s in sems
|
|
|
|
]
|
2020-09-26 16:19:37 +02:00
|
|
|
)
|
2024-02-22 16:50:25 +01:00
|
|
|
H.append(f"<li><b>{ue.acronyme}</b> : {slist}</li>")
|
2020-09-26 16:19:37 +02:00
|
|
|
H.append("</ul></div>")
|
|
|
|
|
|
|
|
return "\n".join(H), ue_multiples
|