File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -290,16 +290,23 @@ export class UserService {
290290 } ,
291291 } ) ;
292292
293- const update_classes = _timetable . selectedClasses . map ( ( c ) =>
294- this . prisma . class . upsert ( {
295- where : { id : c . id } ,
296- update : c ,
293+ const update_classes = _timetable . selectedClasses . map ( ( c ) => {
294+ // TODO: Get the actual field instead of computing it
295+ // classNo is currently a string such as COMP6420Undergraduate-11965-T1-2025
296+ // courseId should be a string such as COMP6420Undergraduate
297+ const selectedClass = {
298+ courseId : c . classNo . split ( '-' ) [ 0 ] ,
299+ ...c ,
300+ } ;
301+ return this . prisma . class . upsert ( {
302+ where : { id : selectedClass . id } ,
303+ update : selectedClass ,
297304 create : {
298- ...c ,
305+ ...selectedClass ,
299306 timetableId : _timetableId ,
300307 } ,
301- } ) ,
302- ) ;
308+ } ) ;
309+ } ) ;
303310
304311 await this . prisma . $transaction ( [
305312 update_timetable ,
You can’t perform that action at this time.
0 commit comments