diff options
author | Dan McGee <dan@archlinux.org> | 2011-08-17 09:01:07 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-17 09:01:07 -0500 |
commit | c80afa08c7aec23984e84bfb3ab5683c9c392115 (patch) | |
tree | fa477a892d12edef331b25aeeeb85722d94f76cd /releng/models.py | |
parent | 61311701a51cc5b060d5baa56536805aa271f9d6 (diff) |
releng: refactor results overview page for performance
Use some annotation stuff and trickeration to reduce the number of
queries we need on the results overview page by quite a bit.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'releng/models.py')
-rw-r--r-- | releng/models.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/releng/models.py b/releng/models.py index 3afef55e..a958288b 100644 --- a/releng/models.py +++ b/releng/models.py @@ -10,36 +10,10 @@ class IsoOption(models.Model): def __unicode__(self): return self.name - def get_test_result(self, success): - try: - return self.test_set.filter(success=success).select_related( - 'iso').latest('iso__id').iso - except Test.DoesNotExist: - return None - - def get_last_success(self): - return self.get_test_result(True) - - def get_last_failure(self): - return self.get_test_result(False) - class Meta: abstract = True class RollbackOption(IsoOption): - def get_rollback_test_result(self, success): - try: - return self.rollback_test_set.filter(success=success).select_related( - 'iso').latest('iso__id').iso - except Test.DoesNotExist: - return None - - def get_last_rollback_success(self): - return self.get_rollback_test_result(True) - - def get_last_rollback_failure(self): - return self.get_rollback_test_result(False) - class Meta: abstract = True |