Mise à jour, re-ordonne db migrations

This commit is contained in:
Emmanuel Viennet 2021-11-09 22:39:04 +01:00
commit 94325cef2c
6 changed files with 44 additions and 7 deletions

View File

@ -49,7 +49,7 @@ class AbsenceNotification(db.Model):
nbabsjust = db.Column(db.Integer)
formsemestre_id = db.Column(
db.Integer,
db.ForeignKey("notes_formsemestre.id"),
db.ForeignKey("notes_formsemestre.id", ondelete="CASCADE"),
)

View File

@ -631,7 +631,7 @@ class NotesTable(object):
matiere_sum_coefs += coef
matiere_id_last = matiere_id
except TypeError: # val == "NI" "NA"
assert val == "NI" or val == "NA"
assert val == "NI" or val == "NA" or val == "ERR"
nb_missing = nb_missing + 1
coefs.append(0)
coefs_mask.append(0)

View File

@ -30,6 +30,8 @@
import collections
import enum
from app import log
@enum.unique
class CodesParcours(enum.IntEnum):
@ -720,4 +722,9 @@ FORMATION_PARCOURS_TYPES = [p[0] for p in _tp] # codes numeriques (TYPE_PARCOUR
def get_parcours_from_code(code_parcours):
return TYPES_PARCOURS[code_parcours]
parcours = TYPES_PARCOURS.get(code_parcours)
if parcours is None:
log(f"Warning: invalid code_parcours: {code_parcours}")
# default to legacy
parcours = TYPES_PARCOURS.get(0)
return parcours

View File

@ -1657,9 +1657,9 @@ def evaluation_create(moduleimpl_id):
)
@bp.route("/evaluation_listenotes")
@bp.route("/evaluation_listenotes", methods=["GET", "POST"]) # API ScoDoc 7 compat
@scodoc
@permission_required(Permission.ScoView)
@permission_required_compat_scodoc7(Permission.ScoView)
@scodoc7func
def evaluation_listenotes():
"""Affichage des notes d'une évaluation"""

View File

@ -0,0 +1,30 @@
"""added cascade on absences_notifications
Revision ID: 1efe07413835
Revises: 75cf18659984
Create Date: 2021-11-09 11:49:31.739803
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1efe07413835'
down_revision = '75cf18659984'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('absences_notifications_formsemestre_id_fkey', 'absences_notifications', type_='foreignkey')
op.create_foreign_key(None, 'absences_notifications', 'notes_formsemestre', ['formsemestre_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'absences_notifications', type_='foreignkey')
op.create_foreign_key('absences_notifications_formsemestre_id_fkey', 'absences_notifications', 'notes_formsemestre', ['formsemestre_id'], ['id'])
# ### end Alembic commands ###

View File

@ -1,7 +1,7 @@
"""BUT: poids evaluations, AC
Revision ID: ada0d1f3d84f
Revises: 75cf18659984
Revises: 1efe07413835
Create Date: 2021-11-07 22:49:22.697211
"""
@ -11,7 +11,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "ada0d1f3d84f"
down_revision = "75cf18659984"
down_revision = "1efe07413835"
branch_labels = None
depends_on = None