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
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"""
evaluation: Evaluation = db.session.get(Evaluation, evaluation_id)
am, pm = evaluation.is_matin(), evaluation.is_apresmidi()
# 1 si matin, 0 si apres midi, 2 si toute la journee:
match am, pm:
@ -249,7 +250,7 @@ def formsemestre_check_absences_html(formsemestre_id):
):
H.append(
evaluation_check_absences_html(
evaluation.id, # XXX TODO-ASSIDUITE remplacer par evaluation ...
evaluation,
with_header=False,
show_ok=False,
)

View File

@ -1377,20 +1377,18 @@ def group_rename(group_id):
return group_set_name(group, tf[2]["group_name"])
def groups_auto_repartition(partition_id=None):
"""Reparti les etudiants dans des groupes dans une partition, en respectant le niveau
def groups_auto_repartition(partition: Partition):
"""Réparti les etudiants dans des groupes dans une partition, en respectant le niveau
et la mixité.
"""
partition: Partition = Partition.query.get_or_404(partition_id)
if not partition.groups_editable:
raise AccessDenied("Partition non éditable")
formsemestre_id = partition.formsemestre_id
formsemestre = partition.formsemestre
# renvoie sur page édition partitions et groupes
dest_url = url_for(
"scolar.partition_editor",
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
formsemestre_id=formsemestre.id,
)
if not formsemestre.can_change_groups():
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 = [
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>
<p>Semestre {formsemestre.titre_annee()}</p>
<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 = {}
for civilite in civilites:
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()
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
</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>
</div>
`;

View File

@ -44,7 +44,6 @@ from app import models
from app.auth.models import User
from app.but import (
apc_edit_ue,
bulletin_but_court,
cursus_but,
jury_edit_manual,
jury_but,
@ -58,21 +57,23 @@ from app.but.forms import jury_but_forms
from app.comp import jury, res_sem
from app.comp.res_compat import NotesTableCompat
from app.models import (
ApcNiveau,
BulAppreciations,
DispenseUE,
Evaluation,
Formation,
FormSemestre,
FormSemestreInscription,
FormSemestreUEComputationExpr,
Identite,
Module,
ModuleImpl,
ScolarAutorisationInscription,
ScolarNews,
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.views import notes_bp as bp
@ -1790,11 +1791,17 @@ sco_publish(
sco_undo_notes.evaluation_list_operations,
Permission.ScoView,
)
sco_publish(
"/evaluation_check_absences_html",
sco_evaluation_check_abs.evaluation_check_absences_html,
Permission.ScoView,
)
@bp.route("/evaluation_check_absences_html/<int:evaluation_id>")
@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(
"/formsemestre_check_absences_html",
sco_evaluation_check_abs.formsemestre_check_absences_html,

View File

@ -50,14 +50,16 @@ from app.decorators import (
scodoc7func,
permission_required,
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.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 ScoData
@ -67,7 +69,6 @@ from app.scodoc.scolog import logdb
from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_exceptions import (
AccessDenied,
ScoException,
ScoValueError,
)
@ -845,12 +846,15 @@ sco_publish(
methods=["GET", "POST"],
)
sco_publish(
"/groups_auto_repartition",
sco_groups.groups_auto_repartition,
Permission.ScoView,
methods=["GET", "POST"],
)
@bp.route("/groups_auto_repartition/<int:partition_id>", methods=["GET", "POST"])
@scodoc
@permission_required(Permission.ScoView)
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(
"/edit_partition_form",

View File

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