feat(problemset): add sorting by id in problemset page

This commit is contained in:
cfngc4594 2025-03-12 12:52:50 +08:00
parent 6d61e6e783
commit c58ed38c03

View File

@ -26,6 +26,9 @@ const getDifficultyColor = (difficulty: Difficulty) => {
export default async function ProblemsetPage() { export default async function ProblemsetPage() {
const problems = await prisma.problem.findMany({ const problems = await prisma.problem.findMany({
where: { published: true }, where: { published: true },
orderBy: {
id: "asc",
},
}); });
return ( return (
@ -60,9 +63,7 @@ export default async function ProblemsetPage() {
{problem.title} {problem.title}
</Link> </Link>
</TableCell> </TableCell>
<TableCell <TableCell className={`py-2.5 ${getDifficultyColor(problem.difficulty)}`}>
className={`py-2.5 ${getDifficultyColor(problem.difficulty)}`}
>
{problem.difficulty} {problem.difficulty}
</TableCell> </TableCell>
</TableRow> </TableRow>