Skip to content

Commit

Permalink
Fix type:check errors
Browse files Browse the repository at this point in the history
  • Loading branch information
francisli committed Jan 24, 2025
1 parent ab9ba5a commit 34251a2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
12 changes: 4 additions & 8 deletions src/backend/routers/iep.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,20 @@ test("addTask - no duplicate benchmark_id + assigned_id combo", async (t) => {
metric_name: "words",
attempts_per_trial: 10,
number_of_trials: 30,
due_date: new Date("2023-12-31"),
trial_count: 5,
});
const benchmark1Id = benchmark1!.benchmark_id;

await trpc.iep.addTask.mutate({
benchmark_id: benchmark1Id,
assignee_id: para_id,
due_date: new Date("2023-12-31"),
trial_count: 5,
});

const error = await t.throwsAsync(async () => {
await trpc.iep.addTask.mutate({
benchmark_id: benchmark1Id,
assignee_id: para_id,
due_date: new Date("2024-03-31"),
trial_count: 1,
});
});

Expand Down Expand Up @@ -204,22 +202,20 @@ test("assignTaskToParas - no duplicate benchmark_id + para_id combo", async (t)
metric_name: "words",
attempts_per_trial: 10,
number_of_trials: 30,
due_date: new Date("2023-12-31"),
trial_count: 5,
});
const benchmark1Id = benchmark1!.benchmark_id;

await trpc.iep.assignTaskToParas.mutate({
benchmark_id: benchmark1Id,
para_ids: [para_1.user_id],
due_date: new Date("2023-12-31"),
trial_count: 5,
});

const error = await t.throwsAsync(async () => {
await trpc.iep.assignTaskToParas.mutate({
benchmark_id: benchmark1Id,
para_ids: [para_1.user_id, para_2.user_id],
due_date: new Date("2024-03-31"),
trial_count: 1,
});
});

Expand Down
6 changes: 5 additions & 1 deletion src/backend/routers/student.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ export const student = router({
.innerJoin("iep", "iep.iep_id", "goal.iep_id")
.innerJoin("student", "student.student_id", "iep.student_id")
.where("task.task_id", "=", task_id)
.select(["student.first_name", "student.last_name", "task.due_date"])
.select([
"student.first_name",
"student.last_name",
"benchmark.due_date",
])
.executeTakeFirstOrThrow();

return result;
Expand Down
16 changes: 8 additions & 8 deletions src/components/benchmarks/BenchmarkAssignmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ export const BenchmarkAssignmentModal = (
benchmark_id: props.benchmark_id,
para_ids: selectedParaIds,
// this should be written to benchmarks:
due_date:
assignmentDuration.type === "until_date"
? assignmentDuration.date
: undefined,
trial_count:
assignmentDuration.type === "minimum_number_of_collections"
? assignmentDuration.minimumNumberOfCollections
: undefined,
// due_date:
// assignmentDuration.type === "until_date"
// ? assignmentDuration.date
// : undefined,
// trial_count:
// assignmentDuration.type === "minimum_number_of_collections"
// ? assignmentDuration.minimumNumberOfCollections
// : undefined,
});
handleClose();
} catch (err) {
Expand Down

0 comments on commit 34251a2

Please sign in to comment.