Skip to content

Commit 57852b2

Browse files
committed
fix: piscine counts in dropdown menus
was not taking cursus_users into account and included staff
1 parent f080e3c commit 57852b2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/utils.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ export const getAllPiscines = async function(prisma: PrismaClient, limitToCurren
7878
{ pool_year_num: 'desc' },
7979
{ pool_month_num: 'desc' },
8080
],
81+
where: {
82+
kind: {
83+
not: 'admin',
84+
},
85+
cursus_users: {
86+
some: {
87+
OR: [
88+
{
89+
cursus_id: 4 // deprecated Piscine C
90+
},
91+
{
92+
cursus_id: 9 // new C Piscine
93+
},
94+
],
95+
},
96+
},
97+
},
8198
});
8299
const piscines: Piscine[] = piscines_users.flatMap((p) => {
83100
// Do not include empty pool_month or pool_year

0 commit comments

Comments
 (0)