Checkpoint: Correction du filtrage des inscriptions annulées
- Modification de getInscriptionsBySequence pour exclure les inscriptions avec statut "annulee" - Modification de getInscriptionsByApprenant pour exclure les inscriptions avec statut "annulee" - Ajout de l'import de la fonction ne depuis drizzle-orm - Vérification que le scheduler de rappels filtre déjà correctement (envoie uniquement aux inscriptions confirmées)
This commit is contained in:
12
server/db.ts
12
server/db.ts
@@ -1,4 +1,4 @@
|
||||
import { eq, and, sql } from "drizzle-orm";
|
||||
import { eq, and, ne, sql } from "drizzle-orm";
|
||||
import { drizzle } from "drizzle-orm/mysql2";
|
||||
import {
|
||||
InsertUser,
|
||||
@@ -367,7 +367,10 @@ export async function getInscriptionsBySequence(sequenceId: number) {
|
||||
})
|
||||
.from(inscriptions)
|
||||
.leftJoin(apprenants, eq(inscriptions.apprenantId, apprenants.id))
|
||||
.where(eq(inscriptions.sequenceId, sequenceId));
|
||||
.where(and(
|
||||
eq(inscriptions.sequenceId, sequenceId),
|
||||
ne(inscriptions.statut, 'annulee')
|
||||
));
|
||||
|
||||
return results;
|
||||
}
|
||||
@@ -382,7 +385,10 @@ export async function getInscriptionsByApprenant(apprenantId: number) {
|
||||
})
|
||||
.from(inscriptions)
|
||||
.leftJoin(sequences, eq(inscriptions.sequenceId, sequences.id))
|
||||
.where(eq(inscriptions.apprenantId, apprenantId));
|
||||
.where(and(
|
||||
eq(inscriptions.apprenantId, apprenantId),
|
||||
ne(inscriptions.statut, 'annulee')
|
||||
));
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user