Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
Showing only changes of commit 77e4c4f726 - Show all commits

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 )
);
""" """
) )
) )