From 746ed0e08a1c16716796f6ac504a95f56e973aa3 Mon Sep 17 00:00:00 2001 From: Vincent Shuali Date: Thu, 16 Jan 2025 18:31:26 -0800 Subject: [PATCH] WIP: Fix two more frontend page router pages --- .../[benchmark_id]/instructions.tsx | 2 +- .../benchmarks/[benchmark_id]/review.tsx | 27 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/pages/benchmarks/[benchmark_id]/instructions.tsx b/src/pages/benchmarks/[benchmark_id]/instructions.tsx index 4a606cfb..d084a22e 100644 --- a/src/pages/benchmarks/[benchmark_id]/instructions.tsx +++ b/src/pages/benchmarks/[benchmark_id]/instructions.tsx @@ -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) } ); diff --git a/src/pages/benchmarks/[benchmark_id]/review.tsx b/src/pages/benchmarks/[benchmark_id]/review.tsx index 4f486ea4..d7cff881 100644 --- a/src/pages/benchmarks/[benchmark_id]/review.tsx +++ b/src/pages/benchmarks/[benchmark_id]/review.tsx @@ -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(); @@ -32,20 +33,20 @@ const ReviewPage = () => { } }; - if (isLoading || !task) { + if (isLoading || !benchmark) { return
Loading...
; } - const currentTrial = task.trials[task.trials.length - 1]; + const currentTrial = benchmark.trials[benchmark.trials.length - 1]; return (

- Trial {task.trials.length} + Trial {benchmark.trials.length}

- {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.

Observation Notes: