Skip to content

Commit

Permalink
fix: show no project left message when judging is done
Browse files Browse the repository at this point in the history
  • Loading branch information
arian81 committed Jan 10, 2025
1 parent 618047e commit f969bf4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
14 changes: 13 additions & 1 deletion src/pages/judging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const Judging: NextPage = () => {
trpc.table.getTables.useQuery();
const { mutate: submitJudgment } =
trpc.judging.createJudgingResult.useMutation();
// TODO: Change this endpoint to only handle one thing, not filtering on projectId
const {
data: nextProject,
refetch: refetchNextProject,
Expand Down Expand Up @@ -280,7 +281,18 @@ const Judging: NextPage = () => {
</div>
<div className="flex flex-col lg:flex-row gap-4">
{/* Project judging form */}
{selectedTable && nextProject && (
{!nextProject && (
/* Placeholder for no projects */

<div className="flex-1 rounded-md h-fit p-3 sm:p-6 dark:bg-neutral-800 border-neutral-300 dark:border-neutral-700 bg-white border">
<h1>No projects available</h1>
<p className="text-neutral-500">
There are no more projects available for judging at this
time.
</p>
</div>
)}
{nextProject && selectedTable && (
<div className="flex-1 rounded-md h-fit p-3 sm:p-6 dark:bg-neutral-800 border-neutral-300 dark:border-neutral-700 bg-white border">
<div
className={`${isProjectLoading ? "opacity-50" : ""}`}
Expand Down
11 changes: 1 addition & 10 deletions src/server/router/judging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,8 @@ export const projectRouter = router({
},
});

// If all projects have been judged, return the first project
if (!timeSlot) {
return ctx.prisma.project.findFirst({
where: {
TimeSlot: {
some: {
tableId: input.tableId,
},
},
},
});
return null;
}

return timeSlot?.project;
Expand Down

0 comments on commit f969bf4

Please sign in to comment.