From 8059e1622fdc5ea47fde71f1c79e90676eb19cb6 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 20 Dec 2021 20:38:21 +0100 Subject: [PATCH] =?UTF-8?q?Renomme=20qq=20mod=C3=A8les=20(CamelCase=20sur?= =?UTF-8?q?=20FormSemestre)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/bulletin_but.py | 1 - app/models/__init__.py | 12 +++--- app/models/etudiants.py | 2 +- app/models/formsemestre.py | 16 +++---- app/models/notes.py | 2 +- app/scodoc/sco_edit_apc.py | 4 +- app/scodoc/sco_liste_notes.py | 13 +++--- app/scodoc/sco_utils.py | 2 +- app/views/notes.py | 6 +-- app/views/scodoc.py | 4 +- ...b02c89_index_in_formsemestreinscription.py | 42 +++++++++++++++---- sco_version.py | 2 +- scodoc.py | 4 +- 13 files changed, 68 insertions(+), 42 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index cd1c59a5..4ff2849f 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -25,7 +25,6 @@ class ResultatsSemestreBUT: """Structure légère pour stocker les résultats du semestre et générer les bulletins. __init__ : charge depuis le cache ou calcule - invalidate(): invalide données cachées """ _cached_attrs = ( diff --git a/app/models/__init__.py b/app/models/__init__.py index 66e22432..0fee7bc4 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -35,12 +35,12 @@ from app.models.modules import Module, ModuleUECoef, NotesTag, notes_modules_tag from app.models.ues import UniteEns from app.models.formsemestre import ( FormSemestre, - FormsemestreEtape, + FormSemestreEtape, FormationModalite, - FormsemestreUECoef, - FormsemestreUEComputationExpr, - FormsemestreCustomMenu, - FormsemestreInscription, + FormSemestreUECoef, + FormSemestreUEComputationExpr, + FormSemestreCustomMenu, + FormSemestreInscription, notes_formsemestre_responsables, NotesSemSet, notes_semset_formsemestre, @@ -57,7 +57,7 @@ from app.models.evaluations import ( from app.models.groups import Partition, GroupDescr, group_membership from app.models.notes import ( ScolarEvent, - ScolarFormsemestreValidation, + ScolarFormSemestreValidation, ScolarAutorisationInscription, BulAppreciations, NotesNotes, diff --git a/app/models/etudiants.py b/app/models/etudiants.py index cddac171..c4e2ab42 100644 --- a/app/models/etudiants.py +++ b/app/models/etudiants.py @@ -104,7 +104,7 @@ class Identite(db.Model): False si pas inscrit, ou scu.INSCRIT, DEMISSION, DEF """ # voir si ce n'est pas trop lent: - ins = models.FormsemestreInscription.query.filter_by( + ins = models.FormSemestreInscription.query.filter_by( etudid=self.id, formsemestre_id=formsemestre_id ).first() if ins: diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index 3d5ddd30..450ea2cc 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -82,7 +82,7 @@ class FormSemestre(db.Model): # Relations: etapes = db.relationship( - "FormsemestreEtape", cascade="all,delete", backref="formsemestre" + "FormSemestreEtape", cascade="all,delete", backref="formsemestre" ) modimpls = db.relationship("ModuleImpl", backref="formsemestre", lazy="dynamic") etuds = db.relationship( @@ -119,7 +119,7 @@ class FormSemestre(db.Model): return d def query_ues(self, with_sport=False) -> flask_sqlalchemy.BaseQuery: - """UE des modules de ce semestre. + """UE des modules de ce semestre, triées par numéro. - Formations classiques: les UEs auxquelles appartiennent les modules mis en place dans ce semestre. - Formations APC / BUT: les UEs de la formation qui ont @@ -262,7 +262,7 @@ notes_formsemestre_responsables = db.Table( ) -class FormsemestreEtape(db.Model): +class FormSemestreEtape(db.Model): """Étape Apogée associées au semestre""" __tablename__ = "notes_formsemestre_etapes" @@ -331,7 +331,7 @@ class FormationModalite(db.Model): raise -class FormsemestreUECoef(db.Model): +class FormSemestreUECoef(db.Model): """Coef des UE capitalisees arrivant dans ce semestre""" __tablename__ = "notes_formsemestre_uecoef" @@ -350,7 +350,7 @@ class FormsemestreUECoef(db.Model): coefficient = db.Column(db.Float, nullable=False) -class FormsemestreUEComputationExpr(db.Model): +class FormSemestreUEComputationExpr(db.Model): """Formules utilisateurs pour calcul moyenne UE""" __tablename__ = "notes_formsemestre_ue_computation_expr" @@ -370,7 +370,7 @@ class FormsemestreUEComputationExpr(db.Model): computation_expr = db.Column(db.Text()) -class FormsemestreCustomMenu(db.Model): +class FormSemestreCustomMenu(db.Model): """Menu custom associe au semestre""" __tablename__ = "notes_formsemestre_custommenu" @@ -386,7 +386,7 @@ class FormsemestreCustomMenu(db.Model): idx = db.Column(db.Integer, default=0, server_default="0") # rang dans le menu -class FormsemestreInscription(db.Model): +class FormSemestreInscription(db.Model): """Inscription à un semestre de formation""" __tablename__ = "notes_formsemestre_inscription" @@ -410,7 +410,7 @@ class FormsemestreInscription(db.Model): backref=db.backref( "inscriptions", cascade="all, delete-orphan", - order_by="FormsemestreInscription.etudid", + order_by="FormSemestreInscription.etudid", ), ) # I inscrit, D demission en cours de semestre, DEF si "defaillant" diff --git a/app/models/notes.py b/app/models/notes.py index c196596f..df2766d0 100644 --- a/app/models/notes.py +++ b/app/models/notes.py @@ -40,7 +40,7 @@ class ScolarEvent(db.Model): ) -class ScolarFormsemestreValidation(db.Model): +class ScolarFormSemestreValidation(db.Model): """Décisions de jury""" __tablename__ = "scolar_formsemestre_validation" diff --git a/app/scodoc/sco_edit_apc.py b/app/scodoc/sco_edit_apc.py index 3e23414c..0d129d81 100644 --- a/app/scodoc/sco_edit_apc.py +++ b/app/scodoc/sco_edit_apc.py @@ -32,7 +32,7 @@ from flask_login import current_user from app import db from app.models import Formation, UniteEns, Matiere, Module, FormSemestre, ModuleImpl -from app.models.notes import ScolarFormsemestreValidation +from app.models.notes import ScolarFormSemestreValidation import app.scodoc.sco_utils as scu from app.scodoc import sco_groups from app.scodoc.sco_utils import ModuleType @@ -152,7 +152,7 @@ def html_ue_infos(ue): ) .all() ) - nb_etuds_valid_ue = ScolarFormsemestreValidation.query.filter_by( + nb_etuds_valid_ue = ScolarFormSemestreValidation.query.filter_by( ue_id=ue.id ).count() can_safely_be_suppressed = ( diff --git a/app/scodoc/sco_liste_notes.py b/app/scodoc/sco_liste_notes.py index 09e5480f..6da2e3f8 100644 --- a/app/scodoc/sco_liste_notes.py +++ b/app/scodoc/sco_liste_notes.py @@ -56,7 +56,7 @@ from app.scodoc.htmlutils import histogram_notes def do_evaluation_listenotes( evaluation_id=None, moduleimpl_id=None, format="html" -) -> str: +) -> tuple[str, str]: """ Affichage des notes d'une évaluation (si evaluation_id) ou de toutes les évaluations d'un module (si moduleimpl_id) @@ -71,7 +71,7 @@ def do_evaluation_listenotes( else: raise ValueError("missing argument: evaluation or module") if not evals: - return "

Aucune évaluation !

" + return "

Aucune évaluation !

", f"ScoDoc" E = evals[0] # il y a au moins une evaluation modimpl = ModuleImpl.query.get(E["moduleimpl_id"]) @@ -189,9 +189,12 @@ def do_evaluation_listenotes( if tf[0] == 0: return "\n".join(H) + "\n" + tf[1], page_title elif tf[0] == -1: - return flask.redirect( - "%s/Notes/moduleimpl_status?moduleimpl_id=%s" - % (scu.ScoURL(), E["moduleimpl_id"]) + return ( + flask.redirect( + "%s/Notes/moduleimpl_status?moduleimpl_id=%s" + % (scu.ScoURL(), E["moduleimpl_id"]) + ), + "", ) else: anonymous_listing = tf[2]["anonymous_listing"] diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index 35d13cbf..3b6b065c 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -72,7 +72,7 @@ NOTES_SUPPRESS = -1001.0 # note a supprimer NOTES_ATTENTE = -1002.0 # note "en attente" (se calcule comme une note neutralisee) # ---- CODES INSCRIPTION AUX SEMESTRES -# (champ etat de FormsemestreInscription) +# (champ etat de FormSemestreInscription) INSCRIT = "I" DEMISSION = "D" DEF = "DEF" diff --git a/app/views/notes.py b/app/views/notes.py index 30222830..5523a10e 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -1739,7 +1739,7 @@ def evaluation_listenotes(): mode = "module" format = vals.get("format", "html") - B, page_title = sco_liste_notes.do_evaluation_listenotes( + html_content, page_title = sco_liste_notes.do_evaluation_listenotes( evaluation_id=evaluation_id, moduleimpl_id=moduleimpl_id, format=format ) if format == "html": @@ -1750,9 +1750,9 @@ def evaluation_listenotes(): init_qtip=True, ) F = html_sco_header.sco_footer() - return H + B + F + return H + html_content + F else: - return B + return html_content sco_publish( diff --git a/app/views/scodoc.py b/app/views/scodoc.py index 301dfbb4..dfd8bcfe 100644 --- a/app/views/scodoc.py +++ b/app/views/scodoc.py @@ -54,7 +54,7 @@ from wtforms.validators import ValidationError, DataRequired, Email, EqualTo import app from app.models import Departement, Identite -from app.models import FormSemestre, FormsemestreInscription +from app.models import FormSemestre, FormSemestreInscription from app.models import ScoDocSiteConfig import sco_version from app.scodoc import sco_logos, sco_config_form @@ -134,7 +134,7 @@ def get_etud_dept(): last_etud = None last_date = None for etud in etuds: - inscriptions = FormsemestreInscription.query.filter_by(etudid=etud.id).all() + inscriptions = FormSemestreInscription.query.filter_by(etudid=etud.id).all() for ins in inscriptions: date_fin = FormSemestre.query.get(ins.formsemestre_id).date_fin if (last_date is None) or date_fin > last_date: diff --git a/migrations/versions/4f98a8b02c89_index_in_formsemestreinscription.py b/migrations/versions/4f98a8b02c89_index_in_formsemestreinscription.py index 179ed98c..b867e291 100644 --- a/migrations/versions/4f98a8b02c89_index_in_formsemestreinscription.py +++ b/migrations/versions/4f98a8b02c89_index_in_formsemestreinscription.py @@ -1,4 +1,4 @@ -"""index in FormsemestreInscription +"""index in FormSemestreInscription Revision ID: 4f98a8b02c89 Revises: a57a6ee2e3cb @@ -10,23 +10,47 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. -revision = '4f98a8b02c89' -down_revision = 'a57a6ee2e3cb' +revision = "4f98a8b02c89" +down_revision = "a57a6ee2e3cb" branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.create_index(op.f('ix_notes_formsemestre_inscription_etat'), 'notes_formsemestre_inscription', ['etat'], unique=False) - op.create_index(op.f('ix_notes_formsemestre_inscription_etudid'), 'notes_formsemestre_inscription', ['etudid'], unique=False) - op.create_index(op.f('ix_notes_formsemestre_inscription_formsemestre_id'), 'notes_formsemestre_inscription', ['formsemestre_id'], unique=False) + op.create_index( + op.f("ix_notes_formsemestre_inscription_etat"), + "notes_formsemestre_inscription", + ["etat"], + unique=False, + ) + op.create_index( + op.f("ix_notes_formsemestre_inscription_etudid"), + "notes_formsemestre_inscription", + ["etudid"], + unique=False, + ) + op.create_index( + op.f("ix_notes_formsemestre_inscription_formsemestre_id"), + "notes_formsemestre_inscription", + ["formsemestre_id"], + unique=False, + ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f('ix_notes_formsemestre_inscription_formsemestre_id'), table_name='notes_formsemestre_inscription') - op.drop_index(op.f('ix_notes_formsemestre_inscription_etudid'), table_name='notes_formsemestre_inscription') - op.drop_index(op.f('ix_notes_formsemestre_inscription_etat'), table_name='notes_formsemestre_inscription') + op.drop_index( + op.f("ix_notes_formsemestre_inscription_formsemestre_id"), + table_name="notes_formsemestre_inscription", + ) + op.drop_index( + op.f("ix_notes_formsemestre_inscription_etudid"), + table_name="notes_formsemestre_inscription", + ) + op.drop_index( + op.f("ix_notes_formsemestre_inscription_etat"), + table_name="notes_formsemestre_inscription", + ) # ### end Alembic commands ### diff --git a/sco_version.py b/sco_version.py index b33f520a..8baaca5e 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.1.11" +SCOVERSION = "9.1.12" SCONAME = "ScoDoc" diff --git a/scodoc.py b/scodoc.py index 26598fc5..d85500f3 100755 --- a/scodoc.py +++ b/scodoc.py @@ -24,7 +24,7 @@ from app.auth.models import User, Role, UserRole from app.models import ScoPreference from app.scodoc.sco_logos import make_logo_local from app.models import Formation, UniteEns, Module -from app.models import FormSemestre, FormsemestreInscription +from app.models import FormSemestre, FormSemestreInscription from app.models import ModuleImpl, ModuleImplInscription from app.models import Identite from app.models.evaluations import Evaluation @@ -57,7 +57,7 @@ def make_shell_context(): "flask": flask, "Formation": Formation, "FormSemestre": FormSemestre, - "FormsemestreInscription": FormsemestreInscription, + "FormSemestreInscription": FormSemestreInscription, "Identite": Identite, "login_user": login_user, "logout_user": logout_user,