Petites modifs des imports et routes

This commit is contained in:
Emmanuel Viennet 2023-09-06 08:48:00 +02:00
parent ff337b17b4
commit c587c8b7d2
6 changed files with 52 additions and 39 deletions

View File

@ -108,9 +108,10 @@ def evaluation_check_absences(evaluation: Evaluation):
return ValButAbs, AbsNonSignalee, ExcNonSignalee, ExcNonJust, AbsButExc return ValButAbs, AbsNonSignalee, ExcNonSignalee, ExcNonJust, AbsButExc
def evaluation_check_absences_html(evaluation_id, with_header=True, show_ok=True): def evaluation_check_absences_html(
evaluation: Evaluation, with_header=True, show_ok=True
):
"""Affiche état vérification absences d'une évaluation""" """Affiche état vérification absences d'une évaluation"""
evaluation: Evaluation = db.session.get(Evaluation, evaluation_id)
am, pm = evaluation.is_matin(), evaluation.is_apresmidi() am, pm = evaluation.is_matin(), evaluation.is_apresmidi()
# 1 si matin, 0 si apres midi, 2 si toute la journee: # 1 si matin, 0 si apres midi, 2 si toute la journee:
match am, pm: match am, pm:
@ -249,7 +250,7 @@ def formsemestre_check_absences_html(formsemestre_id):
): ):
H.append( H.append(
evaluation_check_absences_html( evaluation_check_absences_html(
evaluation.id, # XXX TODO-ASSIDUITE remplacer par evaluation ... evaluation,
with_header=False, with_header=False,
show_ok=False, show_ok=False,
) )

View File

@ -1377,20 +1377,18 @@ def group_rename(group_id):
return group_set_name(group, tf[2]["group_name"]) return group_set_name(group, tf[2]["group_name"])
def groups_auto_repartition(partition_id=None): def groups_auto_repartition(partition: Partition):
"""Reparti les etudiants dans des groupes dans une partition, en respectant le niveau """Réparti les etudiants dans des groupes dans une partition, en respectant le niveau
et la mixité. et la mixité.
""" """
partition: Partition = Partition.query.get_or_404(partition_id)
if not partition.groups_editable: if not partition.groups_editable:
raise AccessDenied("Partition non éditable") raise AccessDenied("Partition non éditable")
formsemestre_id = partition.formsemestre_id
formsemestre = partition.formsemestre formsemestre = partition.formsemestre
# renvoie sur page édition partitions et groupes # renvoie sur page édition partitions et groupes
dest_url = url_for( dest_url = url_for(
"scolar.partition_editor", "scolar.partition_editor",
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre.id,
) )
if not formsemestre.can_change_groups(): if not formsemestre.can_change_groups():
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !") raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
@ -1409,7 +1407,9 @@ def groups_auto_repartition(partition_id=None):
] ]
H = [ H = [
html_sco_header.sco_header(page_title="Répartition des groupes"), html_sco_header.sco_header(
page_title="Répartition des groupes", formsemestre_id=formsemestre.id
),
f"""<h2>Répartition des groupes de {partition.partition_name}</h2> f"""<h2>Répartition des groupes de {partition.partition_name}</h2>
<p>Semestre {formsemestre.titre_annee()}</p> <p>Semestre {formsemestre.titre_annee()}</p>
<p class="help">Les groupes existants seront <b>effacés</b> et remplacés par <p class="help">Les groupes existants seront <b>effacés</b> et remplacés par
@ -1455,7 +1455,7 @@ def groups_auto_repartition(partition_id=None):
listes = {} listes = {}
for civilite in civilites: for civilite in civilites:
listes[civilite] = [ listes[civilite] = [
(_get_prev_moy(x["etudid"], formsemestre_id), x["etudid"]) (_get_prev_moy(x["etudid"], formsemestre.id), x["etudid"])
for x in identdict.values() for x in identdict.values()
if x["civilite"] == civilite if x["civilite"] == civilite
] ]

View File

@ -224,7 +224,8 @@
<input class=groupe type=checkbox ${partition.show_in_lists ? "checked" : ""} data-attr=show_in_lists> Afficher sur bulletins et tableaux <input class=groupe type=checkbox ${partition.show_in_lists ? "checked" : ""} data-attr=show_in_lists> Afficher sur bulletins et tableaux
</label> </label>
<label> <label>
<a class="stdlink" href="/ScoDoc/{{formsemestre.departement.acronym}}/Scolarite/groups_auto_repartition?partition_id=${partition.id}">Répartir les étudiants</a> <a class="stdlink" href="{{scu.ScoURL()
}}/groups_auto_repartition/${partition.id}">Répartir les étudiants</a>
</label> </label>
</div> </div>
`; `;

View File

@ -44,7 +44,6 @@ from app import models
from app.auth.models import User from app.auth.models import User
from app.but import ( from app.but import (
apc_edit_ue, apc_edit_ue,
bulletin_but_court,
cursus_but, cursus_but,
jury_edit_manual, jury_edit_manual,
jury_but, jury_but,
@ -58,21 +57,23 @@ from app.but.forms import jury_but_forms
from app.comp import jury, res_sem from app.comp import jury, res_sem
from app.comp.res_compat import NotesTableCompat from app.comp.res_compat import NotesTableCompat
from app.models import ( from app.models import (
ApcNiveau,
BulAppreciations, BulAppreciations,
DispenseUE,
Evaluation, Evaluation,
Formation, Formation,
FormSemestre,
FormSemestreInscription,
FormSemestreUEComputationExpr,
Identite,
Module,
ModuleImpl,
ScolarAutorisationInscription, ScolarAutorisationInscription,
ScolarNews, ScolarNews,
Scolog, Scolog,
ScoDocSiteConfig,
UniteEns,
) )
from app.models.but_refcomp import ApcNiveau
from app.models.config import ScoDocSiteConfig
from app.models.etudiants import Identite
from app.models.formsemestre import FormSemestre, FormSemestreInscription
from app.models.formsemestre import FormSemestreUEComputationExpr
from app.models.moduleimpls import ModuleImpl
from app.models.modules import Module
from app.models.ues import DispenseUE, UniteEns
from app.scodoc.sco_exceptions import ScoFormationConflict, ScoPermissionDenied from app.scodoc.sco_exceptions import ScoFormationConflict, ScoPermissionDenied
from app.views import notes_bp as bp from app.views import notes_bp as bp
@ -1790,11 +1791,17 @@ sco_publish(
sco_undo_notes.evaluation_list_operations, sco_undo_notes.evaluation_list_operations,
Permission.ScoView, Permission.ScoView,
) )
sco_publish(
"/evaluation_check_absences_html",
sco_evaluation_check_abs.evaluation_check_absences_html, @bp.route("/evaluation_check_absences_html/<int:evaluation_id>")
Permission.ScoView, @scodoc
) @permission_required(Permission.ScoView)
def evaluation_check_absences_html(evaluation_id: int):
"Check absences sur une évaluation"
evaluation: Evaluation = Evaluation.query.get_or_404(evaluation_id)
return sco_evaluation_check_abs.evaluation_check_absences_html(evaluation)
sco_publish( sco_publish(
"/formsemestre_check_absences_html", "/formsemestre_check_absences_html",
sco_evaluation_check_abs.formsemestre_check_absences_html, sco_evaluation_check_abs.formsemestre_check_absences_html,

View File

@ -50,14 +50,16 @@ from app.decorators import (
scodoc7func, scodoc7func,
permission_required, permission_required,
permission_required_compat_scodoc7, permission_required_compat_scodoc7,
admin_required,
login_required,
) )
from app.models.etudiants import Identite from app.models import (
FormSemestre,
Identite,
Partition,
ScolarEvent,
ScolarNews,
Scolog,
)
from app.models.etudiants import make_etud_args from app.models.etudiants import make_etud_args
from app.models.events import ScolarNews, Scolog
from app.models.formsemestre import FormSemestre
from app.models.validations import ScolarEvent
from app.views import scolar_bp as bp from app.views import scolar_bp as bp
from app.views import ScoData from app.views import ScoData
@ -67,7 +69,6 @@ from app.scodoc.scolog import logdb
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_exceptions import ( from app.scodoc.sco_exceptions import (
AccessDenied, AccessDenied,
ScoException,
ScoValueError, ScoValueError,
) )
@ -845,12 +846,15 @@ sco_publish(
methods=["GET", "POST"], methods=["GET", "POST"],
) )
sco_publish(
"/groups_auto_repartition", @bp.route("/groups_auto_repartition/<int:partition_id>", methods=["GET", "POST"])
sco_groups.groups_auto_repartition, @scodoc
Permission.ScoView, @permission_required(Permission.ScoView)
methods=["GET", "POST"], def groups_auto_repartition(partition_id: int):
) "Réparti les etudiants dans des groupes dans une partition"
partition: Partition = Partition.query.get_or_404(partition_id)
return sco_groups.groups_auto_repartition(partition)
sco_publish( sco_publish(
"/edit_partition_form", "/edit_partition_form",

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.6.20" SCOVERSION = "9.6.21"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"