|
2 | 2 | import { Button } from "@/components/ui/button"; |
3 | 3 | import { PopoverArrow, PopoverBody, PopoverContent, PopoverRoot, PopoverTrigger } from "@/components/ui/popover"; |
4 | 4 | import { |
5 | | - SubmissionWithGraderResultsAndErrors, |
6 | 5 | SubmissionWithGraderResultsAndFiles, |
7 | 6 | SubmissionWithGraderResultsAndReview |
8 | 7 | } from "@/utils/supabase/DatabaseTypes"; |
| 8 | +import { Database } from "@/utils/supabase/SupabaseTypes"; |
| 9 | +import { UnstableGetResult as GetResult } from "@supabase/postgrest-js"; |
9 | 10 | import { Box, Flex, Heading, HStack, List, Skeleton, Table, Text, VStack } from "@chakra-ui/react"; |
10 | 11 |
|
11 | 12 | import { AdjustDueDateDialog } from "@/app/course/[course_id]/manage/assignments/[assignment_id]/due-date-exceptions/page"; |
@@ -259,16 +260,19 @@ function SubmissionReviewScoreTweak() { |
259 | 260 | } |
260 | 261 | // Select query for full submission data with grader results, test outputs, and files |
261 | 262 | const FULL_SUBMISSION_SELECT = |
262 | | - "*, grader_results(*, grader_result_tests(*, grader_result_test_output(*)), grader_result_output(*)), submission_reviews!submissions_grading_review_id_fkey(*), repository_check_runs!submissions_repository_check_run_id_fkey(commit_message), submission_files(name, contents)"; |
| 263 | + "*, grader_results!grader_results_submission_id_fkey(*, grader_result_tests(*, grader_result_test_output(*)), grader_result_output(*)), submission_reviews!submissions_grading_review_id_fkey(*), repository_check_runs!submissions_repository_check_run_id_fkey(commit_message), submission_files(name, contents)"; |
263 | 264 |
|
264 | | -type SubmissionFileBasic = { name: string; contents: string | null }; |
| 265 | +// Type that matches the FULL_SUBMISSION_SELECT query result |
| 266 | +type FullSubmissionQueryResult = GetResult< |
| 267 | + Database["public"], |
| 268 | + Database["public"]["Tables"]["submissions"]["Row"], |
| 269 | + "submissions", |
| 270 | + Database["public"]["Tables"]["submissions"]["Relationships"], |
| 271 | + "*, grader_results!grader_results_submission_id_fkey(*, grader_result_tests(*, grader_result_test_output(*)), grader_result_output(*)), submission_reviews!submissions_grading_review_id_fkey(*), repository_check_runs!submissions_repository_check_run_id_fkey(commit_message), submission_files(name, contents)" |
| 272 | +>; |
265 | 273 |
|
266 | 274 | // Use Omit to avoid implying assignments/workflow_run_error are populated (they aren't in our query) |
267 | | -type FullSubmissionData = Omit<SubmissionWithGraderResultsAndErrors, "assignments" | "workflow_run_error"> & { |
268 | | - submission_reviews: SubmissionWithGraderResultsAndReview["submission_reviews"]; |
269 | | - repository_check_runs: { commit_message: string } | null; |
270 | | - submission_files: SubmissionFileBasic[] | null; |
271 | | -}; |
| 275 | +type FullSubmissionData = FullSubmissionQueryResult; |
272 | 276 |
|
273 | 277 | // Simple diff generator that shows added/removed lines between two strings |
274 | 278 | function generateSimpleDiff(oldContent: string | null, newContent: string | null): string { |
|
0 commit comments