add basic (user) history for collections

This commit is contained in:
Ross
2024-09-23 11:49:36 +01:00
parent 5f23134fa6
commit edc9b29233
8 changed files with 222 additions and 21 deletions
+15
View File
@@ -555,6 +555,14 @@ class SeriesImage(SeriesImageBase):
help_text="Reference to the object that has replaced this one.",
)
def get_file_size(self):
try:
return self.image.size
# We catch this for when the image does not exist
except FileNotFoundError:
return 0
def get_dicom_data(self):
try:
with pydicom.dcmread(self.image) as d:
@@ -1066,6 +1074,13 @@ class CaseDetail(models.Model):
"""Returns the correct question answers as a json string"""
return json.dumps(self.question_answers)
def get_user_answers(self, user):
"""Returns the users answers as a json string"""
try:
return UserReportAnswer.objects.get(question=self, user=user)
except UserReportAnswer.DoesNotExist:
return None
class CasePrior(models.Model):
case_detail = models.ForeignKey(CaseDetail, on_delete=models.CASCADE)
prior_case = models.ForeignKey(Case, on_delete=models.CASCADE, related_name="prior_case")