Skip to content

Commit

Permalink
WIP: Fix two more frontend page router pages
Browse files Browse the repository at this point in the history
  • Loading branch information
canjalal committed Jan 17, 2025
1 parent 9dd7b5f commit 746ed0e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/pages/benchmarks/[benchmark_id]/instructions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const InstructionsPage = () => {
const { benchmark_id } = router.query;
const { data: benchmark, isLoading } =
trpc.iep.getBenchmarkAndTrialData.useQuery(
{ task_id: benchmark_id as string },
{ benchmark_id: benchmark_id as string },
{ enabled: Boolean(benchmark_id) }
);

Expand Down
27 changes: 14 additions & 13 deletions src/pages/benchmarks/[benchmark_id]/review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import $button from "@/components/design_system/button/Button.module.css";
const ReviewPage = () => {
const router = useRouter();
const { benchmark_id } = router.query;
const { data: task, isLoading } = trpc.iep.getBenchmarkAndTrialData.useQuery(
{
task_id: benchmark_id as string, // how does this line make sense?
},
{
enabled: Boolean(benchmark_id),
}
);
const { data: benchmark, isLoading } =
trpc.iep.getBenchmarkAndTrialData.useQuery(
{
benchmark_id: benchmark_id as string, // how does this line make sense?
},
{
enabled: Boolean(benchmark_id),
}
);

const updateTrialMutation = trpc.iep.updateTrialData.useMutation();

Expand All @@ -32,20 +33,20 @@ const ReviewPage = () => {
}
};

if (isLoading || !task) {
if (isLoading || !benchmark) {
return <div>Loading...</div>;
}

const currentTrial = task.trials[task.trials.length - 1];
const currentTrial = benchmark.trials[benchmark.trials.length - 1];

return (
<div>
<h2 className={`${$box.topAndBottomBorder} ${$box.flex}`}>
Trial {task.trials.length}
Trial {benchmark.trials.length}
</h2>
<div className={$box.default}>
{task.first_name} completed {currentTrial.success} successful attempts
and {currentTrial.unsuccess} unsuccessful attempts.
{benchmark.first_name} completed {currentTrial.success} successful
attempts and {currentTrial.unsuccess} unsuccessful attempts.
</div>
<div className={$box.default}>
<h4>Observation Notes:</h4>
Expand Down

0 comments on commit 746ed0e

Please sign in to comment.