summaryrefslogtreecommitdiffstats
path: root/engagements/models.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--engagements/models.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/engagements/models.py b/engagements/models.py
index 20bed8d..b0dfe2b 100644
--- a/engagements/models.py
+++ b/engagements/models.py
@@ -154,6 +154,9 @@ class Engagement(Common):
"L4RIF": "L4 RIF",
}
+ def get_officers(self):
+ 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)
return sum([x.effort_total_hours() for x in p_effort])
@@ -173,7 +176,7 @@ class Engagement(Common):
def dscs(self):
"Return all declared DSCs as part of REGULATION effort"
dscs = set()
- for ee in EngagementEffort.objects.filter(engagement=self, effort_type="REGULATION"):
+ for ee in EngagementEffort.objects.filter(engagement=self):
for si in ee.sub_instruments.all():
dscs.add(si)
return dscs
@@ -191,7 +194,7 @@ class EngagementEffort(Common):
("PLANNING", "Planning"),
("REGULATION", "Regulation (On-site or Remote)"),
("DISCUSSION", "Discussion"),
- ("REPORT", "Reporting"),
+ ("REPORTING", "Reporting"),
)
is_planned = models.BooleanField(null=True, blank=True, verbose_name="Planned", default=True)
effort_type = models.CharField(max_length=32, choices=choices, verbose_name="Effort Type")
@@ -206,6 +209,9 @@ class EngagementEffort(Common):
verbose_name_plural = "Engagement Effort"
ordering = ("proposed_start_date",)
+ def get_officers(self):
+ return [" ".join([x.first_name, x.last_name]) for x in self.officers.all()]
+
def effort_total_hours(self):
"Returns total effort for this engagement."
delta = self.proposed_end_date - self.proposed_start_date