1
0
forked from ScoDoc/ScoDoc

WIP: jury BUT: esquisse page saisie

This commit is contained in:
Emmanuel Viennet 2022-06-21 11:21:41 +02:00
parent a37a2c08e2
commit c1e279ed5c

View File

@ -2237,30 +2237,98 @@ def formsemestre_validation_but(formsemestre_id: int, etudid: int):
page_title="Validation BUT", formsemestre_id=formsemestre_id, etudid=etudid page_title="Validation BUT", formsemestre_id=formsemestre_id, etudid=etudid
), ),
f""" f"""
<h2>XXX Experimental XXX</h2> <h2>Jury BUT</h2>
<div class="jury_but">
""", """,
] ]
formsemestre = FormSemestre.query.get_or_404(formsemestre_id) formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
etud = Identite.query.get_or_404(etudid) etud = Identite.query.get_or_404(etudid)
res: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre) res: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre)
# ---- UEs deca = jury_but.DecisionsProposeesAnnee(etud, formsemestre)
H.append(
f"""
<div class="titre_parcours">Parcours: {deca.parcour.libelle or "non spécifié"}
en BUT{deca.annee_but}
</div>
<p>Année: <em>{deca.explanation}</em><br>{
_gen_but_select("code_annee", deca.codes, deca.code_valide)
}</p>
<h2>Niveaux de compétences</h2>
<div class="but_annee">
"""
)
for niveau in deca.niveaux_competences:
H.append(
f"""<div class="but_niveau_titre">
<span title="{niveau.competence.titre_long}">{niveau.competence.titre}</span>
</div>"""
)
dec_rcue = deca.decisions_rcue_by_niveau[niveau.id]
# Semestre impair
ue = dec_rcue.rcue.ue_1
H.append(
f"""<div class="but_niveau_ue">
<span title="{ue.titre}">{ue.acronyme}</span>
<span class="but_note">{scu.fmt_note(dec_rcue.rcue.moy_ue_1)}</span>
<span class="but_code">{
_gen_but_select("code_ue_"+str(ue.id),
deca.decisions_ues[ue.id].codes,
deca.decisions_ues[ue.id].code_valide
)
}</span>
</div>"""
)
# Semestre pair
ue = dec_rcue.rcue.ue_2
H.append(
f"""<div class="but_niveau_ue">
<span title="{ue.titre}">{ue.acronyme}</span>
<span class="but_note">{scu.fmt_note(dec_rcue.rcue.moy_ue_2)}</span>
<span class="but_code">{
_gen_but_select("code_ue_"+str(ue.id),
deca.decisions_ues[ue.id].codes,
deca.decisions_ues[ue.id].code_valide
)
}</span>
</div>"""
)
# RCUE
H.append(
f"""<div class="but_niveau_rcue">
<span class="but_note">{scu.fmt_note(dec_rcue.rcue.moy_rcue)}</span>
<span class="but_code">{
_gen_but_select("code_rcue_"+str(niveau.id),
dec_rcue.codes,
dec_rcue.code_valide
)
}</span>
</div>"""
)
H.append("</div>") # but_annee
# ---- Toutes les UEs, pour infos
H.append(f"<ul>") H.append(f"<ul>")
for ue in formsemestre.query_ues(): # volontairement toutes les UE for ue in formsemestre.query_ues(): # volontairement toutes les UE
dec_proposee = jury_but.DecisionsProposeesUE(etud, formsemestre, ue) dec_proposee = jury_but.DecisionsProposeesUE(etud, formsemestre, ue)
H.append("<li>" + html.escape(f"""{ue} : {dec_proposee}""") + "</li>") H.append("<li>" + html.escape(f"""{ue} : {dec_proposee}""") + "</li>")
H.append(f"</ul>") H.append(f"</ul>")
H.append(f"</div>")
if formsemestre.semestre_id % 2 == 0:
# ---- RCUES
H.append(f"<ul>")
for ue in formsemestre.query_ues(): # volontairement toutes les UE
dec_proposee = jury_but.decisions_ue_proposees(etud, formsemestre, ue)
H.append("<li>" + html.escape(f"""{ue} : {dec_proposee}""") + "</li>")
H.append(f"</ul>")
return "\n".join(H) + html_sco_header.sco_footer() return "\n".join(H) + html_sco_header.sco_footer()
def _gen_but_select(name: str, codes: list[str], code_valide: str) -> str:
"Le menu html select avec les codes"
h = "\n".join(
[
f"""<option value="{code}" {'selected' if code == code_valide else ''}>{code}</option>"""
for code in codes
]
)
return f"""<select name="{name}">{h}</select>"""
@bp.route("/formsemestre_validate_previous_ue", methods=["GET", "POST"]) @bp.route("/formsemestre_validate_previous_ue", methods=["GET", "POST"])
@scodoc @scodoc
@permission_required(Permission.ScoView) @permission_required(Permission.ScoView)