summaryrefslogtreecommitdiffstats
path: root/engagements/models.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-10-14 14:30:59 +0100
committerMatthew Lemon <y@yulqen.org>2024-10-14 14:35:17 +0100
commit40b1200f93ce9cf54be885015232dbdd5ddce29e (patch)
treeb7079258f8aca990af8a816662826ead76669467 /engagements/models.py
parent20d41b60fe6545a69750835c23a52e1fb218b13c (diff)
Fixed DSCs and Officers in summary panel
Previously these were either hard-coded or missing. There is still a problem with the alignment of the SVG and the text in the CSS grid. The list of officers is based on officers added to the Engagement itself and the effort objects assigned to the engagement - it shows a compound of all.
Diffstat (limited to 'engagements/models.py')
-rw-r--r--engagements/models.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/engagements/models.py b/engagements/models.py
index 45d8e69..24acabd 100644
--- a/engagements/models.py
+++ b/engagements/models.py
@@ -1,3 +1,5 @@
+from itertools import chain
+
from django.conf import settings
from django.db import models
from django.db.models import Q
@@ -158,7 +160,11 @@ class Engagement(Common):
}
def get_officers(self):
- return [" ".join([x.first_name, x.last_name]) for x in self.officers.all()]
+ officers_from_effort = list(chain.from_iterable([x.officers.all() for x in self.effort.all()]))
+ return [o.fullname() for o in set(officers_from_effort + list(self.officers.all()))]
+ return "toss"
+
+ # return [" ".join([x.first_name, x.last_name]) for x in self.officers.all()]
def total_planning_effort(self):
p_effort = self.engagementeffort_set.all().filter(is_planned=True)