staging changes

This commit is contained in:
Ross
2023-04-22 13:24:00 +01:00
parent 651a201bd4
commit cd5cbdd1a5
3 changed files with 35 additions and 4 deletions
+24 -3
View File
@@ -213,9 +213,26 @@ class Long(models.Model):
return marker_unmarked
def get_question_json(self, based=True, feedback=False):
# self == q?
# q = get_object_or_404(Long, pk=question_id)
def get_question_model_answers(self):
"""Returns a dict of the question model answers"""
return {
"observations": self.model_observations,
"interpretation": self.model_interpretation,
"principle diagnosis": self.model_principle_diagnosis,
"differential_diagnosis": self.model_differential_diagnosis,
"management": self.model_management,
}
def get_question_json(self, based: bool=True, answers: bool=True, feedback: bool=False):
"""Returns a json representation of the question
if based = False return is a dict
otherwise a url to the json file
answers arg is only parsed if based = False
"""
question_id = self.pk
if not based:
@@ -249,6 +266,10 @@ class Long(models.Model):
"type": "long",
"cached": False,
}
if answers:
question_json["answers"] = self.get_question_model_answers()
return question_json
# exam_order.append(q.id)