improve findings
This commit is contained in:
@@ -774,6 +774,21 @@ class Series(SeriesBase):
|
||||
def get_link_headers(self):
|
||||
return "atlas/series_headers.html"
|
||||
|
||||
def get_related_findings(self):
|
||||
"""Returns the related findings for the series, including findings from other series in the same case."""
|
||||
# Get findings directly related to this series
|
||||
findings = list(self.findings.all())
|
||||
|
||||
# Get findings from other series in the same case
|
||||
if hasattr(self, "case") and self.case.exists():
|
||||
for case in self.case.all():
|
||||
for other_series in case.series.exclude(pk=self.pk):
|
||||
findings.extend(other_series.findings.all())
|
||||
|
||||
# Remove duplicates (by pk)
|
||||
unique_findings = {f.pk: f for f in findings}.values()
|
||||
return list(unique_findings)
|
||||
|
||||
|
||||
|
||||
class CaseCollection(ExamOrCollectionGenericBase):
|
||||
|
||||
Reference in New Issue
Block a user