diff --git a/app/models/absences.py b/app/models/absences.py index e6e243b7..658a390d 100644 --- a/app/models/absences.py +++ b/app/models/absences.py @@ -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"), ) diff --git a/app/scodoc/notes_table.py b/app/scodoc/notes_table.py index 27617c00..9f9314e2 100644 --- a/app/scodoc/notes_table.py +++ b/app/scodoc/notes_table.py @@ -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) diff --git a/app/scodoc/sco_codes_parcours.py b/app/scodoc/sco_codes_parcours.py index f1dcf485..922cf906 100644 --- a/app/scodoc/sco_codes_parcours.py +++ b/app/scodoc/sco_codes_parcours.py @@ -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 diff --git a/app/views/notes.py b/app/views/notes.py index e4162a07..deea62bf 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -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""" diff --git a/migrations/versions/1efe07413835_added_cascade_on_absences_notifications.py b/migrations/versions/1efe07413835_added_cascade_on_absences_notifications.py new file mode 100644 index 00000000..c568000c --- /dev/null +++ b/migrations/versions/1efe07413835_added_cascade_on_absences_notifications.py @@ -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 ### diff --git a/migrations/versions/ada0d1f3d84f_but_poids_evaluations_ac.py b/migrations/versions/ada0d1f3d84f_but_poids_evaluations_ac.py index eb23fc60..a0ba7eec 100644 --- a/migrations/versions/ada0d1f3d84f_but_poids_evaluations_ac.py +++ b/migrations/versions/ada0d1f3d84f_but_poids_evaluations_ac.py @@ -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