Skip to content

Commit

Permalink
adding subject_id to task and exercise json representation
Browse files Browse the repository at this point in the history
  • Loading branch information
ooemperor committed Jan 20, 2024
1 parent 7aa17f6 commit b5be7a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions codeGrader/backend/db/Exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def toJson(self, recursive: bool = True) -> dict:

if self.subject_id is None:
out["subject"] = None
out["subject_id"] = None
else:
out["subject"] = self.ExerciseSubject.toJson(recursive=False)
out["subject_id"] = self.subject_id

return out
2 changes: 2 additions & 0 deletions codeGrader/backend/db/Task.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ def toJson(self, recursive: bool = True) -> dict:
out["tag"] = self.tag
if self.TaskExercise is None:
out["exercise"] = None
out["subject_id"] = None
else:
out["exercise"] = self.TaskExercise.toJson(recursive=False)
out["subject_id"] = self.TaskExercise.subject_id

if recursive:

Expand Down

0 comments on commit b5be7a3

Please sign in to comment.