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
générer les bulletins.
__init__ : charge depuis le cache ou calcule
invalidate(): invalide données cachées
"""
_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.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,

View File

@ -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:

View File

@ -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"

View File

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

View File

@ -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 = (

View File

@ -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 "<p>Aucune évaluation !</p>"
return "<p>Aucune évaluation !</p>", 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"]

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)
# ---- CODES INSCRIPTION AUX SEMESTRES
# (champ etat de FormsemestreInscription)
# (champ etat de FormSemestreInscription)
INSCRIT = "I"
DEMISSION = "D"
DEF = "DEF"

View File

@ -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(

View File

@ -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:

View File

@ -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 ###

View File

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

View File

@ -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,