1
0
forked from ScoDoc/ScoDoc

Fix: affichage coef. évaluations modules bonus

This commit is contained in:
Emmanuel Viennet 2022-10-15 10:27:00 +02:00
parent 4da21bf4d3
commit caf88c5909
4 changed files with 17 additions and 14 deletions

View File

@ -63,7 +63,7 @@ def create_user():
user.set_password(form.password.data) user.set_password(form.password.data)
db.session.add(user) db.session.add(user)
db.session.commit() db.session.commit()
flash("User {} created".format(user.user_name)) flash(f"Utilisateur {user.user_name} créé")
return redirect(url_for("scodoc.index")) return redirect(url_for("scodoc.index"))
return render_template( return render_template(
"auth/register.html", title="Création utilisateur", form=form "auth/register.html", title="Création utilisateur", form=form
@ -104,7 +104,7 @@ def reset_password_request():
@bp.route("/reset_password/<token>", methods=["GET", "POST"]) @bp.route("/reset_password/<token>", methods=["GET", "POST"])
def reset_password(token): def reset_password(token):
"Reset passord après demande par mail" "Reset password après demande par mail"
if current_user.is_authenticated: if current_user.is_authenticated:
return redirect(url_for("scodoc.index")) return redirect(url_for("scodoc.index"))
user: User = User.verify_reset_password_token(token) user: User = User.verify_reset_password_token(token)

View File

@ -229,13 +229,13 @@ def get_default_group(formsemestre_id, fix_if_missing=False):
# No default group (problem during sem creation) # No default group (problem during sem creation)
# Try to create it # Try to create it
log( log(
"*** Warning: get_default_group(formsemestre_id=%s): default group missing, recreating it" f"""*** Warning: get_default_group(formsemestre_id={formsemestre_id
% formsemestre_id }): default group missing, recreating it"""
) )
try: try:
partition_id = get_default_partition(formsemestre_id)["partition_id"] partition_id = get_default_partition(formsemestre_id)["partition_id"]
except ScoException: except ScoException:
log("creating default partition for %s" % formsemestre_id) log(f"creating default partition for {formsemestre_id}")
partition_id = partition_create( partition_id = partition_create(
formsemestre_id, default=True, redirect=False formsemestre_id, default=True, redirect=False
) )
@ -243,7 +243,7 @@ def get_default_group(formsemestre_id, fix_if_missing=False):
return group.id return group.id
# debug check # debug check
if len(r) != 1: if len(r) != 1:
raise ScoException("invalid group structure for %s" % formsemestre_id) raise ScoException(f"invalid group structure for {formsemestre_id}")
group_id = r[0]["group_id"] group_id = r[0]["group_id"]
return group_id return group_id

View File

@ -41,6 +41,7 @@ from app.models import ModuleImpl
from app.models.evaluations import Evaluation from app.models.evaluations import Evaluation
from app.models.ues import UniteEns from app.models.ues import UniteEns
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.sco_codes_parcours import UE_SPORT
from app.scodoc.sco_exceptions import ScoInvalidIdType from app.scodoc.sco_exceptions import ScoInvalidIdType
from app.scodoc.sco_cursus_dut import formsemestre_has_decisions from app.scodoc.sco_cursus_dut import formsemestre_has_decisions
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
@ -49,7 +50,6 @@ from app.scodoc import html_sco_header
from app.scodoc import htmlutils from app.scodoc import htmlutils
from app.scodoc import sco_abs from app.scodoc import sco_abs
from app.scodoc import sco_compute_moy from app.scodoc import sco_compute_moy
from app.scodoc import sco_cache
from app.scodoc import sco_edit_module from app.scodoc import sco_edit_module
from app.scodoc import sco_evaluations from app.scodoc import sco_evaluations
from app.scodoc import sco_evaluation_db from app.scodoc import sco_evaluation_db
@ -533,12 +533,15 @@ def _ligne_evaluation(
if evaluation.set_default_poids(): if evaluation.set_default_poids():
db.session.commit() db.session.commit()
coef *= sum(evaluation.get_ue_poids_dict().values()) coef *= sum(evaluation.get_ue_poids_dict().values())
# Avertissement si coefs x poids nuls
if coef < scu.NOTES_PRECISION: if modimpl.module.ue.type != UE_SPORT:
H.append("""<span class="eval_warning_coef">coef. nul !</span>""") # Avertissement si coefs x poids nuls
elif is_apc: if coef < scu.NOTES_PRECISION:
# visualisation des poids H.append("""<span class="eval_warning_coef">coef. nul !</span>""")
H.append(_evaluation_poids_html(evaluation)) elif is_apc:
# visualisation des poids
H.append(_evaluation_poids_html(evaluation))
if evaluation.jour: if evaluation.jour:
H.append( H.append(
f"""Le {evaluation.jour.strftime("%d/%m/%Y")} {evaluation.descr_heure()}""" f"""Le {evaluation.jour.strftime("%d/%m/%Y")} {evaluation.descr_heure()}"""

View File

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