Commit a601468
The teacher exam-grading pages passed data shaped for an older component
contract, so both pages were unusable:
Submissions list (`.../submissions/page.tsx`):
- mapped student_name / score / review_status, but ExamSubmissionsReview reads
profiles.full_name / ai_score / final_score / status → every row showed
"Unknown Student" with "undefined%" scores and all stat cards read 0.
Submission detail (`.../submissions/[submissionId]/page.tsx`):
- same field drift → "undefined%" scores and "Invalid Date".
- filtered exam_questions / exam_answers / exam_question_scores / exam_scores by
`tenant_id`, but none of those tables have a tenant_id column → every query
errored → empty Questions list and no scores. (RLS isolates via the parent
exam/submission, so the explicit filter was both wrong and unnecessary.)
- never passed the `questions` / `answers` props the component reads, so even a
successful query would have rendered nothing.
- onSave expected `{ score, question_overrides[] }` but the component calls
onSave(overrides) keyed by question id → the override never persisted.
Fixes: align both pages to the component contract, drop the invalid tenant_id
filters, pass questions/answers, and rewrite handleSave to consume the real
overrides shape, recompute the overall score from per-question points, and
persist to exam_question_scores / exam_scores / exam_submissions.
Verified on Code Academy Pro (creator admin, alice's Python final): list shows
Alice Student / AI Reviewed / 70%; detail renders all 10 questions with options
and AI scores; overriding Q1 10→5 recomputes 70%→65%, marks the submission
teacher_reviewed, and the list updates to Graded / 65%.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7b3a558 commit a601468
3 files changed
Lines changed: 93 additions & 40 deletions
File tree
- app/[locale]/dashboard/teacher/courses/[courseId]/exams/[examId]/submissions
- [submissionId]
- docs/screenshots
Lines changed: 81 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
69 | | - | |
70 | | - | |
| 68 | + | |
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
| |||
98 | 96 | | |
99 | 97 | | |
100 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
109 | 115 | | |
110 | 116 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | 117 | | |
115 | 118 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
127 | 155 | | |
128 | 156 | | |
129 | 157 | | |
130 | 158 | | |
131 | 159 | | |
132 | | - | |
133 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
134 | 171 | | |
135 | 172 | | |
136 | 173 | | |
137 | 174 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
142 | 179 | | |
143 | | - | |
144 | | - | |
| 180 | + | |
| 181 | + | |
145 | 182 | | |
146 | 183 | | |
147 | 184 | | |
148 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
149 | 190 | | |
150 | 191 | | |
151 | 192 | | |
152 | 193 | | |
153 | 194 | | |
154 | 195 | | |
155 | 196 | | |
156 | | - | |
157 | | - | |
| 197 | + | |
158 | 198 | | |
159 | | - | |
160 | 199 | | |
161 | 200 | | |
162 | 201 | | |
| |||
165 | 204 | | |
166 | 205 | | |
167 | 206 | | |
168 | | - | |
| 207 | + | |
169 | 208 | | |
170 | 209 | | |
171 | 210 | | |
| |||
190 | 229 | | |
191 | 230 | | |
192 | 231 | | |
193 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
194 | 238 | | |
195 | 239 | | |
196 | 240 | | |
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
56 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
57 | 64 | | |
58 | | - | |
59 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
| |||
Loading
0 commit comments