From 7f2e87e9d01f1517fc90e12d92c2576a01076745 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 9 Nov 2021 11:45:51 +0100 Subject: [PATCH 1/5] Fix: exceptions dans formules utilisateurs --- app/scodoc/notes_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From ade1b4445ce0e540d45f3604928dc120f810b49a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 9 Nov 2021 11:47:48 +0100 Subject: [PATCH 2/5] =?UTF-8?q?Tol=C3=A8re=20parcours=20inconnus=20(pour?= =?UTF-8?q?=20dev=20avec=20bases=20du=20futur:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_codes_parcours.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/scodoc/sco_codes_parcours.py b/app/scodoc/sco_codes_parcours.py index ce0ab664..6549643e 100644 --- a/app/scodoc/sco_codes_parcours.py +++ b/app/scodoc/sco_codes_parcours.py @@ -28,6 +28,7 @@ """Semestres: Codes gestion parcours (constantes) """ import collections +from app import log NOTES_TOLERANCE = 0.00499999999999 # si note >= (BARRE-TOLERANCE), considere ok # (permet d'eviter d'afficher 10.00 sous barre alors que la moyenne vaut 9.999) @@ -672,4 +673,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 From a4e4c39797965fe40094681e485b97b18bfd522a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 9 Nov 2021 11:52:41 +0100 Subject: [PATCH 3/5] Fix: suppression semestres avec notifications absences --- app/models/absences.py | 2 +- ...added_cascade_on_absences_notifications.py | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 migrations/versions/1efe07413835_added_cascade_on_absences_notifications.py 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/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 ### From 0573b259d98762f0c3c10017bd54ae1d26555076 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 9 Nov 2021 22:12:11 +0100 Subject: [PATCH 4/5] re-autorise API evaluation_listenotes en mode ScoDoc7 --- app/views/notes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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""" From 03cfcf3298c087bda8709cbcbe6e4f9ec2312d3a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 9 Nov 2021 22:29:20 +0100 Subject: [PATCH 5/5] version bump --- sco_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sco_version.py b/sco_version.py index 56f9121a..24094b5e 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.0.61" +SCOVERSION = "9.0.62" SCONAME = "ScoDoc"