[Pkg-debile-commits] [debile-master] 76/126: fix models

Sylvestre Ledru sylvestre at alioth.debian.org
Mon Aug 19 14:56:18 UTC 2013


This is an automated email from the git hooks/post-receive script.

sylvestre pushed a commit to branch scan-build-html
in repository debile-master.

commit 4db14f65a5f095e2fc1e3670f406c3a69ded52c9
Author: Paul Tagliamonte <tag at pault.ag>
Date:   Sun Jun 9 16:41:41 2013 -0400

    fix models
---
 lucy/models/job.py    |   25 +++++++++++++++++++++++++
 lucy/models/source.py |    4 ++++
 2 files changed, 29 insertions(+)

diff --git a/lucy/models/job.py b/lucy/models/job.py
index ee7cec7..4a57dbc 100644
--- a/lucy/models/job.py
+++ b/lucy/models/job.py
@@ -108,6 +108,31 @@ class Job(LucyObject):
         for x in cls.query({"package": package}):
             yield x
 
+    def is_pending(self):
+        if self['finished_at'] is None:
+            return True
+        return False
+
+    def is_failed(self):
+        for report in self.get_reports():
+            if not report['failed']:
+                return False
+        return True
+
+    def is_critical(self):
+        if self['type'] in [
+            "build",
+            "piuparts",
+            "adequite",
+        ]:
+            return True
+        return False
+
+    @classmethod
+    def by_source(cls, source, **kwargs):
+        for x in cls.query({"source": source}):
+            yield x
+
     @classmethod
     def unfinished_jobs(cls, **kwargs):
         k = {}
diff --git a/lucy/models/source.py b/lucy/models/source.py
index fa5a508..bc8fcec 100644
--- a/lucy/models/source.py
+++ b/lucy/models/source.py
@@ -41,6 +41,10 @@ class Source(LucyObject):
         for x in Binary.query({"source": self['_id']}):
             yield x
 
+    def get_all_jobs(self):
+        from lucy.models.source import Source
+        return Job.by_source(self['_id'])
+
     def get_job_status(self):
         db = lucy.core.db
         total = db.jobs.find({

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-master.git



More information about the Pkg-debile-commits mailing list