From 3354db92caf9ce2f51e9045956ab10aeecaed0b5 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Thu, 25 Feb 2016 23:22:44 +0200 Subject: Added ActiveManager --- servo/models/repair.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'servo') diff --git a/servo/models/repair.py b/servo/models/repair.py index db983dc..6a9e67a 100644 --- a/servo/models/repair.py +++ b/servo/models/repair.py @@ -84,6 +84,14 @@ class ChecklistItemValue(models.Model): app_label = "servo" +class ActiveManager(models.Manager): + """ + GSX repairs that have been submitted, and not marked complete + """ + def active(self, **kwargs): + return self.filter(completed_at=None, **kwargs).exclude(submitted_at=None) + + class Repair(models.Model): """ Proxies service order data between our internal @@ -188,10 +196,11 @@ class Repair(models.Model): symptom_code = models.CharField(max_length=7, default='') issue_code = models.CharField(max_length=7, default='') + active = ActiveManager() def is_submitted(self): return self.submitted_at is not None - + def get_symptom_code_choices(self): """ Returns the possible symptom codes for the current serial number -- cgit v1.2.3