@studious-lms/server 1.2.31 → 1.2.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/routers/_app.d.ts +124 -84
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/assignment.d.ts +36 -16
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +355 -209
- package/dist/routers/class.d.ts +7 -7
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/class.js +18 -2
- package/dist/routers/event.d.ts +2 -2
- package/dist/routers/worksheet.d.ts +17 -17
- package/dist/routers/worksheet.d.ts.map +1 -1
- package/dist/routers/worksheet.js +30 -7
- package/package.json +1 -1
- package/prisma/schema.prisma +4 -3
- package/src/routers/assignment.ts +451 -290
- package/src/routers/class.ts +18 -2
- package/src/routers/worksheet.ts +33 -7
package/dist/routers/class.d.ts
CHANGED
|
@@ -75,8 +75,8 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
75
75
|
}[];
|
|
76
76
|
assignments: {
|
|
77
77
|
late: boolean;
|
|
78
|
-
submitted: boolean;
|
|
79
|
-
returned: boolean;
|
|
78
|
+
submitted: boolean | null | undefined;
|
|
79
|
+
returned: boolean | null | undefined;
|
|
80
80
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
81
81
|
id: string;
|
|
82
82
|
submissions: {
|
|
@@ -560,9 +560,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
560
560
|
acceptExtendedResponse: boolean;
|
|
561
561
|
acceptWorksheet: boolean;
|
|
562
562
|
gradeWithAI: boolean;
|
|
563
|
+
aiPolicyLevel: number;
|
|
563
564
|
inProgress: boolean;
|
|
564
565
|
order: number | null;
|
|
565
|
-
worksheetId: string | null;
|
|
566
566
|
}[];
|
|
567
567
|
meta: object;
|
|
568
568
|
}>;
|
|
@@ -603,9 +603,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
603
603
|
acceptExtendedResponse: boolean;
|
|
604
604
|
acceptWorksheet: boolean;
|
|
605
605
|
gradeWithAI: boolean;
|
|
606
|
+
aiPolicyLevel: number;
|
|
606
607
|
inProgress: boolean;
|
|
607
608
|
order: number | null;
|
|
608
|
-
worksheetId: string | null;
|
|
609
609
|
};
|
|
610
610
|
meta: object;
|
|
611
611
|
}>;
|
|
@@ -646,9 +646,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
646
646
|
acceptExtendedResponse: boolean;
|
|
647
647
|
acceptWorksheet: boolean;
|
|
648
648
|
gradeWithAI: boolean;
|
|
649
|
+
aiPolicyLevel: number;
|
|
649
650
|
inProgress: boolean;
|
|
650
651
|
order: number | null;
|
|
651
|
-
worksheetId: string | null;
|
|
652
652
|
};
|
|
653
653
|
meta: object;
|
|
654
654
|
}>;
|
|
@@ -680,9 +680,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
680
680
|
acceptExtendedResponse: boolean;
|
|
681
681
|
acceptWorksheet: boolean;
|
|
682
682
|
gradeWithAI: boolean;
|
|
683
|
+
aiPolicyLevel: number;
|
|
683
684
|
inProgress: boolean;
|
|
684
685
|
order: number | null;
|
|
685
|
-
worksheetId: string | null;
|
|
686
686
|
};
|
|
687
687
|
meta: object;
|
|
688
688
|
}>;
|
|
@@ -718,9 +718,9 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
718
718
|
acceptExtendedResponse: boolean;
|
|
719
719
|
acceptWorksheet: boolean;
|
|
720
720
|
gradeWithAI: boolean;
|
|
721
|
+
aiPolicyLevel: number;
|
|
721
722
|
inProgress: boolean;
|
|
722
723
|
order: number | null;
|
|
723
|
-
worksheetId: string | null;
|
|
724
724
|
};
|
|
725
725
|
meta: object;
|
|
726
726
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/routers/class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/routers/class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwnCtB,CAAC"}
|
package/dist/routers/class.js
CHANGED
|
@@ -149,6 +149,22 @@ export const classRouter = createTRPCRouter({
|
|
|
149
149
|
},
|
|
150
150
|
},
|
|
151
151
|
assignments: {
|
|
152
|
+
...(!isTeacher && {
|
|
153
|
+
where: { OR: [
|
|
154
|
+
{
|
|
155
|
+
assignedTo: {
|
|
156
|
+
some: {
|
|
157
|
+
id: ctx.user?.id,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
assignedTo: {
|
|
163
|
+
none: {},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
], }
|
|
167
|
+
}),
|
|
152
168
|
select: {
|
|
153
169
|
type: true,
|
|
154
170
|
id: true,
|
|
@@ -209,8 +225,8 @@ export const classRouter = createTRPCRouter({
|
|
|
209
225
|
assignments: classData.assignments.map(assignment => ({
|
|
210
226
|
...assignment,
|
|
211
227
|
late: assignment.dueDate < new Date(),
|
|
212
|
-
submitted: assignment.submissions.
|
|
213
|
-
returned: assignment.submissions.
|
|
228
|
+
submitted: assignment.submissions.find(submission => submission.studentId === ctx.user?.id)?.submitted,
|
|
229
|
+
returned: assignment.submissions.find(submission => submission.studentId === ctx.user?.id)?.returned,
|
|
214
230
|
})),
|
|
215
231
|
};
|
|
216
232
|
const sections = await prisma.section.findMany({
|
package/dist/routers/event.d.ts
CHANGED
|
@@ -185,9 +185,9 @@ export declare const eventRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
185
185
|
acceptExtendedResponse: boolean;
|
|
186
186
|
acceptWorksheet: boolean;
|
|
187
187
|
gradeWithAI: boolean;
|
|
188
|
+
aiPolicyLevel: number;
|
|
188
189
|
inProgress: boolean;
|
|
189
190
|
order: number | null;
|
|
190
|
-
worksheetId: string | null;
|
|
191
191
|
};
|
|
192
192
|
};
|
|
193
193
|
meta: object;
|
|
@@ -234,9 +234,9 @@ export declare const eventRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
234
234
|
acceptExtendedResponse: boolean;
|
|
235
235
|
acceptWorksheet: boolean;
|
|
236
236
|
gradeWithAI: boolean;
|
|
237
|
+
aiPolicyLevel: number;
|
|
237
238
|
inProgress: boolean;
|
|
238
239
|
order: number | null;
|
|
239
|
-
worksheetId: string | null;
|
|
240
240
|
};
|
|
241
241
|
};
|
|
242
242
|
meta: object;
|
|
@@ -36,10 +36,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
36
36
|
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
37
37
|
createdAt: Date;
|
|
38
38
|
order: number | null;
|
|
39
|
-
worksheetId: string;
|
|
40
39
|
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
41
40
|
updatedAt: Date;
|
|
42
41
|
question: string;
|
|
42
|
+
worksheetId: string;
|
|
43
43
|
answer: string;
|
|
44
44
|
}[];
|
|
45
45
|
} & {
|
|
@@ -112,8 +112,8 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
112
112
|
addQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
113
113
|
input: {
|
|
114
114
|
type: "ESSAY" | "MULTIPLE_CHOICE" | "TRUE_FALSE" | "SHORT_ANSWER" | "LONG_ANSWER" | "MATH_EXPRESSION";
|
|
115
|
-
worksheetId: string;
|
|
116
115
|
question: string;
|
|
116
|
+
worksheetId: string;
|
|
117
117
|
answer: string;
|
|
118
118
|
options?: any;
|
|
119
119
|
markScheme?: any;
|
|
@@ -124,20 +124,20 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
124
124
|
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
125
125
|
createdAt: Date;
|
|
126
126
|
order: number | null;
|
|
127
|
-
worksheetId: string;
|
|
128
127
|
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
129
128
|
updatedAt: Date;
|
|
130
129
|
question: string;
|
|
130
|
+
worksheetId: string;
|
|
131
131
|
answer: string;
|
|
132
132
|
};
|
|
133
133
|
meta: object;
|
|
134
134
|
}>;
|
|
135
135
|
reorderQuestions: import("@trpc/server").TRPCMutationProcedure<{
|
|
136
136
|
input: {
|
|
137
|
-
worksheetId: string;
|
|
138
137
|
movedId: string;
|
|
139
138
|
position: "before" | "after";
|
|
140
139
|
targetId: string;
|
|
140
|
+
worksheetId: string;
|
|
141
141
|
};
|
|
142
142
|
output: {
|
|
143
143
|
id: string;
|
|
@@ -160,10 +160,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
160
160
|
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
161
161
|
createdAt: Date;
|
|
162
162
|
order: number | null;
|
|
163
|
-
worksheetId: string;
|
|
164
163
|
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
165
164
|
updatedAt: Date;
|
|
166
165
|
question: string;
|
|
166
|
+
worksheetId: string;
|
|
167
167
|
answer: string;
|
|
168
168
|
};
|
|
169
169
|
meta: object;
|
|
@@ -179,10 +179,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
179
179
|
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
180
180
|
createdAt: Date;
|
|
181
181
|
order: number | null;
|
|
182
|
-
worksheetId: string;
|
|
183
182
|
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
184
183
|
updatedAt: Date;
|
|
185
184
|
question: string;
|
|
185
|
+
worksheetId: string;
|
|
186
186
|
answer: string;
|
|
187
187
|
};
|
|
188
188
|
meta: object;
|
|
@@ -192,7 +192,7 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
192
192
|
submissionId: string;
|
|
193
193
|
worksheetId: string;
|
|
194
194
|
};
|
|
195
|
-
output:
|
|
195
|
+
output: {
|
|
196
196
|
responses: {
|
|
197
197
|
id: string;
|
|
198
198
|
feedback: string | null;
|
|
@@ -209,11 +209,11 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
209
209
|
submissionId: string | null;
|
|
210
210
|
studentId: string;
|
|
211
211
|
createdAt: Date;
|
|
212
|
-
worksheetId: string;
|
|
213
212
|
updatedAt: Date;
|
|
214
213
|
submittedAt: Date | null;
|
|
215
214
|
submitted: boolean;
|
|
216
|
-
|
|
215
|
+
worksheetId: string;
|
|
216
|
+
};
|
|
217
217
|
meta: object;
|
|
218
218
|
}>;
|
|
219
219
|
answerQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -239,10 +239,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
239
239
|
submissionId: string | null;
|
|
240
240
|
studentId: string;
|
|
241
241
|
createdAt: Date;
|
|
242
|
-
worksheetId: string;
|
|
243
242
|
updatedAt: Date;
|
|
244
243
|
submittedAt: Date | null;
|
|
245
244
|
submitted: boolean;
|
|
245
|
+
worksheetId: string;
|
|
246
246
|
}) | null;
|
|
247
247
|
meta: object;
|
|
248
248
|
}>;
|
|
@@ -267,10 +267,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
267
267
|
submissionId: string | null;
|
|
268
268
|
studentId: string;
|
|
269
269
|
createdAt: Date;
|
|
270
|
-
worksheetId: string;
|
|
271
270
|
updatedAt: Date;
|
|
272
271
|
submittedAt: Date | null;
|
|
273
272
|
submitted: boolean;
|
|
273
|
+
worksheetId: string;
|
|
274
274
|
};
|
|
275
275
|
meta: object;
|
|
276
276
|
}>;
|
|
@@ -287,10 +287,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
287
287
|
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
288
288
|
createdAt: Date;
|
|
289
289
|
order: number | null;
|
|
290
|
-
worksheetId: string;
|
|
291
290
|
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
292
291
|
updatedAt: Date;
|
|
293
292
|
question: string;
|
|
293
|
+
worksheetId: string;
|
|
294
294
|
answer: string;
|
|
295
295
|
};
|
|
296
296
|
} & {
|
|
@@ -309,14 +309,14 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
309
309
|
submissionId: string | null;
|
|
310
310
|
studentId: string;
|
|
311
311
|
createdAt: Date;
|
|
312
|
-
worksheetId: string;
|
|
313
312
|
updatedAt: Date;
|
|
314
313
|
submittedAt: Date | null;
|
|
315
314
|
submitted: boolean;
|
|
315
|
+
worksheetId: string;
|
|
316
316
|
};
|
|
317
317
|
meta: object;
|
|
318
318
|
}>;
|
|
319
|
-
|
|
319
|
+
getWorksheetResponse: import("@trpc/server").TRPCQueryProcedure<{
|
|
320
320
|
input: {
|
|
321
321
|
worksheetId: string;
|
|
322
322
|
};
|
|
@@ -336,10 +336,10 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
336
336
|
options: import("@prisma/client/runtime/library").JsonValue | null;
|
|
337
337
|
createdAt: Date;
|
|
338
338
|
order: number | null;
|
|
339
|
-
worksheetId: string;
|
|
340
339
|
markScheme: import("@prisma/client/runtime/library").JsonValue | null;
|
|
341
340
|
updatedAt: Date;
|
|
342
341
|
question: string;
|
|
342
|
+
worksheetId: string;
|
|
343
343
|
answer: string;
|
|
344
344
|
};
|
|
345
345
|
} & {
|
|
@@ -358,11 +358,11 @@ export declare const worksheetRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
358
358
|
submissionId: string | null;
|
|
359
359
|
studentId: string;
|
|
360
360
|
createdAt: Date;
|
|
361
|
-
worksheetId: string;
|
|
362
361
|
updatedAt: Date;
|
|
363
362
|
submittedAt: Date | null;
|
|
364
363
|
submitted: boolean;
|
|
365
|
-
|
|
364
|
+
worksheetId: string;
|
|
365
|
+
}) | null;
|
|
366
366
|
meta: object;
|
|
367
367
|
}>;
|
|
368
368
|
gradeAnswer: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worksheet.d.ts","sourceRoot":"","sources":["../../src/routers/worksheet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA2KA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"worksheet.d.ts","sourceRoot":"","sources":["../../src/routers/worksheet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA2KA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsUhC,CAAC"}
|
|
@@ -186,6 +186,7 @@ export const worksheetRouter = createTRPCRouter({
|
|
|
186
186
|
...(answer !== undefined && { answer }),
|
|
187
187
|
...(markScheme !== undefined && { markScheme }),
|
|
188
188
|
...(type !== undefined && { type }),
|
|
189
|
+
...(options !== undefined && { options }),
|
|
189
190
|
},
|
|
190
191
|
});
|
|
191
192
|
return updatedQuestion;
|
|
@@ -221,11 +222,33 @@ export const worksheetRouter = createTRPCRouter({
|
|
|
221
222
|
if (!submission) {
|
|
222
223
|
throw new TRPCError({ code: 'NOT_FOUND', message: 'Submission not found' });
|
|
223
224
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
// Find or create worksheet response for this submission
|
|
226
|
+
const worksheetResponses = await prisma.$transaction(async (tx) => {
|
|
227
|
+
// First check if a response exists
|
|
228
|
+
const existing = await tx.studentWorksheetResponse.findFirst({
|
|
229
|
+
where: {
|
|
230
|
+
submissionId,
|
|
231
|
+
worksheetId
|
|
232
|
+
},
|
|
233
|
+
include: {
|
|
234
|
+
responses: true,
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
if (existing) {
|
|
238
|
+
return existing;
|
|
239
|
+
}
|
|
240
|
+
// Create new response if it doesn't exist
|
|
241
|
+
const created = await tx.studentWorksheetResponse.create({
|
|
242
|
+
data: {
|
|
243
|
+
worksheetId,
|
|
244
|
+
submissionId,
|
|
245
|
+
studentId: submission.studentId,
|
|
246
|
+
},
|
|
247
|
+
include: {
|
|
248
|
+
responses: true,
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
return created;
|
|
229
252
|
});
|
|
230
253
|
return worksheetResponses;
|
|
231
254
|
}),
|
|
@@ -358,13 +381,13 @@ export const worksheetRouter = createTRPCRouter({
|
|
|
358
381
|
return worksheetResponse;
|
|
359
382
|
}),
|
|
360
383
|
// Get all student responses for a worksheet (teacher view)
|
|
361
|
-
|
|
384
|
+
getWorksheetResponse: protectedProcedure
|
|
362
385
|
.input(z.object({
|
|
363
386
|
worksheetId: z.string(),
|
|
364
387
|
}))
|
|
365
388
|
.query(async ({ ctx, input }) => {
|
|
366
389
|
const { worksheetId } = input;
|
|
367
|
-
const responses = await prisma.studentWorksheetResponse.
|
|
390
|
+
const responses = await prisma.studentWorksheetResponse.findFirst({
|
|
368
391
|
where: { worksheetId },
|
|
369
392
|
include: {
|
|
370
393
|
student: {
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -258,6 +258,8 @@ model Assignment {
|
|
|
258
258
|
acceptWorksheet Boolean @default(false)
|
|
259
259
|
gradeWithAI Boolean @default(false)
|
|
260
260
|
|
|
261
|
+
aiPolicyLevel Int @default(0)
|
|
262
|
+
|
|
261
263
|
submissions Submission[]
|
|
262
264
|
assignedTo User[] @relation("SpecificAssignmentAssignedTo")
|
|
263
265
|
section Section? @relation(fields: [sectionId], references: [id], onDelete: Cascade)
|
|
@@ -275,8 +277,7 @@ model Assignment {
|
|
|
275
277
|
order Int?
|
|
276
278
|
gradingBoundary GradingBoundary? @relation(fields: [gradingBoundaryId], references: [id], onDelete: Cascade)
|
|
277
279
|
gradingBoundaryId String?
|
|
278
|
-
|
|
279
|
-
worksheetId String?
|
|
280
|
+
worksheets Worksheet[] @relation("AssignmentWorksheets")
|
|
280
281
|
}
|
|
281
282
|
|
|
282
283
|
|
|
@@ -502,7 +503,7 @@ model Worksheet {
|
|
|
502
503
|
updatedAt DateTime @updatedAt
|
|
503
504
|
classId String
|
|
504
505
|
class Class? @relation(fields: [classId], references: [id], onDelete: Cascade)
|
|
505
|
-
assignments Assignment[]
|
|
506
|
+
assignments Assignment[] @relation("AssignmentWorksheets")
|
|
506
507
|
questions WorksheetQuestion[]
|
|
507
508
|
studentWorksheetResponses StudentWorksheetResponse[]
|
|
508
509
|
}
|