Skip to content

Commit 11281f6

Browse files
committed
fix: properly hide disabled rankings
in the front-end and and in result calculation
1 parent ce272dd commit 11281f6

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/routes/canvas.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ export const setupCanvasRoutes = function(app: Express, prisma: PrismaClient): v
356356
orderBy: {
357357
type: 'asc',
358358
},
359+
where: {
360+
disabled: false,
361+
}
359362
});
360363
const rankings: { [key: string]: SingleRanking[] } = {};
361364
for (const rankingType of rankingTypes) {

src/routes/home.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ export const setupHomeRoutes = function(app: Express, prisma: PrismaClient): voi
9292
orderBy: {
9393
type: 'asc',
9494
},
95+
where: {
96+
disabled: false,
97+
},
9598
});
9699
const rankings: { [key: string]: SingleRanking[] } = {};
97100
for (const rankingType of rankingTypes) {

src/sync/results.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ export const calculateResults = async function(api: Fast42): Promise<void> {
111111
}
112112

113113
// Season rankings
114-
const rankings = await prisma.codamCoalitionRanking.findMany({});
114+
const rankings = await prisma.codamCoalitionRanking.findMany({
115+
where: {
116+
disabled: false,
117+
},
118+
});
115119
console.log(` - Calculating rankings for season ${seasonName}...`);
116120
for (const ranking of rankings) {
117121
console.log(` - Calculating ranking ${ranking.type}...`);

src/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,10 @@ export const getUserRankingAcrossAllRankings = async function(prisma: PrismaClie
727727
const rankings = await prisma.codamCoalitionRanking.findMany({
728728
select: {
729729
type: true,
730-
}
730+
},
731+
where: {
732+
disabled: false,
733+
},
731734
});
732735
const userRankings: SingleRanking[] = [];
733736
for (const ranking of rankings) {
@@ -746,6 +749,7 @@ export const bonusPointsAwardingStarted = async function(prisma: PrismaClient, a
746749
bonus_points: {
747750
gt: 0,
748751
},
752+
disabled: false,
749753
},
750754
});
751755
if (rankingsAwardingBonusPointsCount === 0) {

0 commit comments

Comments
 (0)