Skip to content

Commit 95cd541

Browse files
committed
feat: add filter for internal score id in admin points history
1 parent 473ced7 commit 95cd541

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/routes/admin/points.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { deleteIntraScore, intraScoreSyncingPossible, syncIntraScore, syncTotalC
99
const SCORES_PER_PAGE = 100;
1010

1111
interface ScoreHistoryFilter {
12-
field: 'login' | 'type' | 'intra_type_id' | 'date' | 'coalition' | 'reason' | 'intra_score_id' | 'none';
12+
field: 'login' | 'type' | 'intra_type_id' | 'date' | 'coalition' | 'reason' | 'intra_score_id' | 'internal_score_id' | 'none';
1313
value?: string;
1414
};
1515

@@ -214,6 +214,18 @@ export const setupAdminPointsRoutes = function(app: Express, prisma: PrismaClien
214214
});
215215
});
216216

217+
app.get('/admin/points/history/internal_score_id/:codamScoreId', async (req, res) => {
218+
const codamScoreId = req.params.codamScoreId;
219+
const parsedCodamScoreId = parseInt(codamScoreId);
220+
if (isNaN(parsedCodamScoreId)) {
221+
return res.status(400).send('Invalid Codam Score ID');
222+
}
223+
224+
return getScoreHistory(req, res, prisma, {
225+
id: parsedCodamScoreId,
226+
}, { field: 'internal_score_id', value: codamScoreId });
227+
});
228+
217229
app.get('/admin/points/history/intra_score_id/:intraScoreId', async (req, res) => {
218230
const intraScoreId = req.params.intraScoreId;
219231

templates/admin/points/history.njk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<option value="date" {{ "selected" if searchFilter == "date" }}>Date (format YYYY-MM-DD)</option>
2222
<option value="coalition" {{ "selected" if searchFilter == "coalition" }}>Coalition Name</option>
2323
<option value="intra_score_id" {{ "selected" if searchFilter == "intra_score_id" }}>Intra Score ID</option>
24+
<option value="internal_score_id" {{ "selected" if searchFilter == "internal_score_id" }}>Internal Score ID</option>
2425
</select>
2526
</div>
2627
<div class="col">

0 commit comments

Comments
 (0)