1
0
forked from ScoDoc/ScoDoc

Corrige migration des validations d'année BUT.

This commit is contained in:
Emmanuel Viennet 2023-06-30 12:10:41 +02:00
parent 61b46db4dd
commit 77e4c4f726

View File

@ -77,19 +77,17 @@ def upgrade():
["id"], ["id"],
) )
# Efface les validations d'année dupliquées # Efface les validations d'année dupliquées
# (garde le premier code dans l'ordre alphabétique... mieux que rien) # (garde la validation la plus récente)
session.execute( session.execute(
sa.text( sa.text(
""" """
DELETE FROM apc_validation_annee t1 DELETE FROM apc_validation_annee t1
WHERE EXISTS ( WHERE t1.id <> (SELECT max(t2.id)
SELECT 1
FROM apc_validation_annee t2 FROM apc_validation_annee t2
WHERE t1.etudid = t2.etudid WHERE t1.etudid = t2.etudid
AND t1.referentiel_competence_id = t2.referentiel_competence_id AND t1.referentiel_competence_id = t2.referentiel_competence_id
AND t1.ordre = t2.ordre AND t1.ordre = t2.ordre
AND t1.code > t2.code )
);
""" """
) )
) )