Skip to content

Commit

Permalink
fix(crac-question): sort questions by lk id
Browse files Browse the repository at this point in the history
  • Loading branch information
HoshinoSuzumi committed May 9, 2024
1 parent 9eb3769 commit 3133ba4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/api/crac/question-bank/[level]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2232,7 +2232,7 @@ export async function GET(
const serverSideProps = await getServerSideProps()
const searchParams = req.nextUrl.searchParams

const questions: ExamQuestion[] = serverSideProps.props.banks[ctx.params.level]
const questions: ExamQuestion[] = serverSideProps.props.banks[ctx.params.level].sort((a, b) => a.id.localeCompare(b.id))
if (searchParams.get('shuffle') === 'true') {
questions.sort(() => Math.random() - 0.5)
}
Expand Down

0 comments on commit 3133ba4

Please sign in to comment.