1
0
forked from ScoDoc/ScoDoc

Renomme qq modèles (CamelCase sur FormSemestre)

This commit is contained in:
Emmanuel Viennet 2021-12-20 20:38:21 +01:00
parent ac5c433f5a
commit 8059e1622f
13 changed files with 68 additions and 42 deletions

View File

@ -25,7 +25,6 @@ class ResultatsSemestreBUT:
"""Structure légère pour stocker les résultats du semestre et """Structure légère pour stocker les résultats du semestre et
générer les bulletins. générer les bulletins.
__init__ : charge depuis le cache ou calcule __init__ : charge depuis le cache ou calcule
invalidate(): invalide données cachées
""" """
_cached_attrs = ( _cached_attrs = (

View File

@ -35,12 +35,12 @@ from app.models.modules import Module, ModuleUECoef, NotesTag, notes_modules_tag
from app.models.ues import UniteEns from app.models.ues import UniteEns
from app.models.formsemestre import ( from app.models.formsemestre import (
FormSemestre, FormSemestre,
FormsemestreEtape, FormSemestreEtape,
FormationModalite, FormationModalite,
FormsemestreUECoef, FormSemestreUECoef,
FormsemestreUEComputationExpr, FormSemestreUEComputationExpr,
FormsemestreCustomMenu, FormSemestreCustomMenu,
FormsemestreInscription, FormSemestreInscription,
notes_formsemestre_responsables, notes_formsemestre_responsables,
NotesSemSet, NotesSemSet,
notes_semset_formsemestre, notes_semset_formsemestre,
@ -57,7 +57,7 @@ from app.models.evaluations import (
from app.models.groups import Partition, GroupDescr, group_membership from app.models.groups import Partition, GroupDescr, group_membership
from app.models.notes import ( from app.models.notes import (
ScolarEvent, ScolarEvent,
ScolarFormsemestreValidation, ScolarFormSemestreValidation,
ScolarAutorisationInscription, ScolarAutorisationInscription,
BulAppreciations, BulAppreciations,
NotesNotes, NotesNotes,

View File

@ -104,7 +104,7 @@ class Identite(db.Model):
False si pas inscrit, ou scu.INSCRIT, DEMISSION, DEF False si pas inscrit, ou scu.INSCRIT, DEMISSION, DEF
""" """
# voir si ce n'est pas trop lent: # 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 etudid=self.id, formsemestre_id=formsemestre_id
).first() ).first()
if ins: if ins:

View File

@ -82,7 +82,7 @@ class FormSemestre(db.Model):
# Relations: # Relations:
etapes = db.relationship( etapes = db.relationship(
"FormsemestreEtape", cascade="all,delete", backref="formsemestre" "FormSemestreEtape", cascade="all,delete", backref="formsemestre"
) )
modimpls = db.relationship("ModuleImpl", backref="formsemestre", lazy="dynamic") modimpls = db.relationship("ModuleImpl", backref="formsemestre", lazy="dynamic")
etuds = db.relationship( etuds = db.relationship(
@ -119,7 +119,7 @@ class FormSemestre(db.Model):
return d return d
def query_ues(self, with_sport=False) -> flask_sqlalchemy.BaseQuery: 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 - Formations classiques: les UEs auxquelles appartiennent
les modules mis en place dans ce semestre. les modules mis en place dans ce semestre.
- Formations APC / BUT: les UEs de la formation qui ont - 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""" """Étape Apogée associées au semestre"""
__tablename__ = "notes_formsemestre_etapes" __tablename__ = "notes_formsemestre_etapes"
@ -331,7 +331,7 @@ class FormationModalite(db.Model):
raise raise
class FormsemestreUECoef(db.Model): class FormSemestreUECoef(db.Model):
"""Coef des UE capitalisees arrivant dans ce semestre""" """Coef des UE capitalisees arrivant dans ce semestre"""
__tablename__ = "notes_formsemestre_uecoef" __tablename__ = "notes_formsemestre_uecoef"
@ -350,7 +350,7 @@ class FormsemestreUECoef(db.Model):
coefficient = db.Column(db.Float, nullable=False) coefficient = db.Column(db.Float, nullable=False)
class FormsemestreUEComputationExpr(db.Model): class FormSemestreUEComputationExpr(db.Model):
"""Formules utilisateurs pour calcul moyenne UE""" """Formules utilisateurs pour calcul moyenne UE"""
__tablename__ = "notes_formsemestre_ue_computation_expr" __tablename__ = "notes_formsemestre_ue_computation_expr"
@ -370,7 +370,7 @@ class FormsemestreUEComputationExpr(db.Model):
computation_expr = db.Column(db.Text()) computation_expr = db.Column(db.Text())
class FormsemestreCustomMenu(db.Model): class FormSemestreCustomMenu(db.Model):
"""Menu custom associe au semestre""" """Menu custom associe au semestre"""
__tablename__ = "notes_formsemestre_custommenu" __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 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""" """Inscription à un semestre de formation"""
__tablename__ = "notes_formsemestre_inscription" __tablename__ = "notes_formsemestre_inscription"
@ -410,7 +410,7 @@ class FormsemestreInscription(db.Model):
backref=db.backref( backref=db.backref(
"inscriptions", "inscriptions",
cascade="all, delete-orphan", cascade="all, delete-orphan",
order_by="FormsemestreInscription.etudid", order_by="FormSemestreInscription.etudid",
), ),
) )
# I inscrit, D demission en cours de semestre, DEF si "defaillant" # I inscrit, D demission en cours de semestre, DEF si "defaillant"

View File

@ -40,7 +40,7 @@ class ScolarEvent(db.Model):
) )
class ScolarFormsemestreValidation(db.Model): class ScolarFormSemestreValidation(db.Model):
"""Décisions de jury""" """Décisions de jury"""
__tablename__ = "scolar_formsemestre_validation" __tablename__ = "scolar_formsemestre_validation"

View File

@ -32,7 +32,7 @@ from flask_login import current_user
from app import db from app import db
from app.models import Formation, UniteEns, Matiere, Module, FormSemestre, ModuleImpl 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 import app.scodoc.sco_utils as scu
from app.scodoc import sco_groups from app.scodoc import sco_groups
from app.scodoc.sco_utils import ModuleType from app.scodoc.sco_utils import ModuleType
@ -152,7 +152,7 @@ def html_ue_infos(ue):
) )
.all() .all()
) )
nb_etuds_valid_ue = ScolarFormsemestreValidation.query.filter_by( nb_etuds_valid_ue = ScolarFormSemestreValidation.query.filter_by(
ue_id=ue.id ue_id=ue.id
).count() ).count()
can_safely_be_suppressed = ( can_safely_be_suppressed = (

View File

@ -56,7 +56,7 @@ from app.scodoc.htmlutils import histogram_notes
def do_evaluation_listenotes( def do_evaluation_listenotes(
evaluation_id=None, moduleimpl_id=None, format="html" evaluation_id=None, moduleimpl_id=None, format="html"
) -> str: ) -> tuple[str, str]:
""" """
Affichage des notes d'une évaluation (si evaluation_id) Affichage des notes d'une évaluation (si evaluation_id)
ou de toutes les évaluations d'un module (si moduleimpl_id) ou de toutes les évaluations d'un module (si moduleimpl_id)
@ -71,7 +71,7 @@ def do_evaluation_listenotes(
else: else:
raise ValueError("missing argument: evaluation or module") raise ValueError("missing argument: evaluation or module")
if not evals: if not evals:
return "<p>Aucune évaluation !</p>" return "<p>Aucune évaluation !</p>", f"ScoDoc"
E = evals[0] # il y a au moins une evaluation E = evals[0] # il y a au moins une evaluation
modimpl = ModuleImpl.query.get(E["moduleimpl_id"]) modimpl = ModuleImpl.query.get(E["moduleimpl_id"])
@ -189,9 +189,12 @@ def do_evaluation_listenotes(
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + "\n" + tf[1], page_title return "\n".join(H) + "\n" + tf[1], page_title
elif tf[0] == -1: elif tf[0] == -1:
return flask.redirect( return (
"%s/Notes/moduleimpl_status?moduleimpl_id=%s" flask.redirect(
% (scu.ScoURL(), E["moduleimpl_id"]) "%s/Notes/moduleimpl_status?moduleimpl_id=%s"
% (scu.ScoURL(), E["moduleimpl_id"])
),
"",
) )
else: else:
anonymous_listing = tf[2]["anonymous_listing"] anonymous_listing = tf[2]["anonymous_listing"]

View File

@ -72,7 +72,7 @@ NOTES_SUPPRESS = -1001.0 # note a supprimer
NOTES_ATTENTE = -1002.0 # note "en attente" (se calcule comme une note neutralisee) NOTES_ATTENTE = -1002.0 # note "en attente" (se calcule comme une note neutralisee)
# ---- CODES INSCRIPTION AUX SEMESTRES # ---- CODES INSCRIPTION AUX SEMESTRES
# (champ etat de FormsemestreInscription) # (champ etat de FormSemestreInscription)
INSCRIT = "I" INSCRIT = "I"
DEMISSION = "D" DEMISSION = "D"
DEF = "DEF" DEF = "DEF"

View File

@ -1739,7 +1739,7 @@ def evaluation_listenotes():
mode = "module" mode = "module"
format = vals.get("format", "html") 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 evaluation_id=evaluation_id, moduleimpl_id=moduleimpl_id, format=format
) )
if format == "html": if format == "html":
@ -1750,9 +1750,9 @@ def evaluation_listenotes():
init_qtip=True, init_qtip=True,
) )
F = html_sco_header.sco_footer() F = html_sco_header.sco_footer()
return H + B + F return H + html_content + F
else: else:
return B return html_content
sco_publish( sco_publish(

View File

@ -54,7 +54,7 @@ from wtforms.validators import ValidationError, DataRequired, Email, EqualTo
import app import app
from app.models import Departement, Identite from app.models import Departement, Identite
from app.models import FormSemestre, FormsemestreInscription from app.models import FormSemestre, FormSemestreInscription
from app.models import ScoDocSiteConfig from app.models import ScoDocSiteConfig
import sco_version import sco_version
from app.scodoc import sco_logos, sco_config_form from app.scodoc import sco_logos, sco_config_form
@ -134,7 +134,7 @@ def get_etud_dept():
last_etud = None last_etud = None
last_date = None last_date = None
for etud in etuds: 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: for ins in inscriptions:
date_fin = FormSemestre.query.get(ins.formsemestre_id).date_fin date_fin = FormSemestre.query.get(ins.formsemestre_id).date_fin
if (last_date is None) or date_fin > last_date: if (last_date is None) or date_fin > last_date:

View File

@ -1,4 +1,4 @@
"""index in FormsemestreInscription """index in FormSemestreInscription
Revision ID: 4f98a8b02c89 Revision ID: 4f98a8b02c89
Revises: a57a6ee2e3cb Revises: a57a6ee2e3cb
@ -10,23 +10,47 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '4f98a8b02c89' revision = "4f98a8b02c89"
down_revision = 'a57a6ee2e3cb' down_revision = "a57a6ee2e3cb"
branch_labels = None branch_labels = None
depends_on = None depends_on = None
def upgrade(): def upgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### 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.create_index(op.f('ix_notes_formsemestre_inscription_etudid'), 'notes_formsemestre_inscription', ['etudid'], unique=False) op.f("ix_notes_formsemestre_inscription_etat"),
op.create_index(op.f('ix_notes_formsemestre_inscription_formsemestre_id'), 'notes_formsemestre_inscription', ['formsemestre_id'], unique=False) "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 ### # ### end Alembic commands ###
def downgrade(): def downgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### 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.drop_index(op.f('ix_notes_formsemestre_inscription_etudid'), table_name='notes_formsemestre_inscription') op.f("ix_notes_formsemestre_inscription_formsemestre_id"),
op.drop_index(op.f('ix_notes_formsemestre_inscription_etat'), table_name='notes_formsemestre_inscription') 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 ### # ### end Alembic commands ###

View File

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

View File

@ -24,7 +24,7 @@ from app.auth.models import User, Role, UserRole
from app.models import ScoPreference from app.models import ScoPreference
from app.scodoc.sco_logos import make_logo_local from app.scodoc.sco_logos import make_logo_local
from app.models import Formation, UniteEns, Module 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 ModuleImpl, ModuleImplInscription
from app.models import Identite from app.models import Identite
from app.models.evaluations import Evaluation from app.models.evaluations import Evaluation
@ -57,7 +57,7 @@ def make_shell_context():
"flask": flask, "flask": flask,
"Formation": Formation, "Formation": Formation,
"FormSemestre": FormSemestre, "FormSemestre": FormSemestre,
"FormsemestreInscription": FormsemestreInscription, "FormSemestreInscription": FormSemestreInscription,
"Identite": Identite, "Identite": Identite,
"login_user": login_user, "login_user": login_user,
"logout_user": logout_user, "logout_user": logout_user,