improve findings

This commit is contained in:
Ross
2025-05-19 11:15:40 +01:00
parent ead5bfcace
commit 503c8f854a
13 changed files with 329 additions and 14 deletions
+15
View File
@@ -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):