aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-02-25 23:22:44 +0200
committerFilipp Lepalaan <filipp@mac.com>2016-02-25 23:22:44 +0200
commit3354db92caf9ce2f51e9045956ab10aeecaed0b5 (patch)
treef518a5bb9b82e21525f6414dc3eca173ba9a9083
parentd7b1aff640ae7c5a9364fc1f76c7245d260ee522 (diff)
downloadServo-3354db92caf9ce2f51e9045956ab10aeecaed0b5.tar.gz
Servo-3354db92caf9ce2f51e9045956ab10aeecaed0b5.tar.bz2
Servo-3354db92caf9ce2f51e9045956ab10aeecaed0b5.zip
Added ActiveManager
-rw-r--r--servo/models/repair.py11
1 files changed, 10 insertions, 1 deletions
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