[Pkg-debile-commits] [debile-web] 01/01: Fix bug in job details page
Jon Severinsson
jonno-guest at moszumanska.debian.org
Fri Mar 28 19:02:13 UTC 2014
This is an automated email from the git hooks/post-receive script.
jonno-guest pushed a commit to branch master
in repository debile-web.
commit d2f69d900026ab4e7a7a733311067104289bd1b8
Author: Jon Severinsson <jon at severinsson.net>
Date: Fri Mar 28 19:27:02 2014 +0100
Fix bug in job details page
---
debileweb/blueprints/frontend.py | 16 +++++++++-------
templates/job.html | 2 ++
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/debileweb/blueprints/frontend.py b/debileweb/blueprints/frontend.py
index 7e1e51d..c61a4e2 100644
--- a/debileweb/blueprints/frontend.py
+++ b/debileweb/blueprints/frontend.py
@@ -542,18 +542,20 @@ def job(job_id, group_name="", package_name="", package_version="", version=""):
job = session.query(Job).get(job_id)
- time_diff = job.finished_at - job.assigned_at
- hours, remainder = divmod(time_diff.total_seconds(), 3600)
- minutes, seconds = divmod(remainder, 60)
-
info = {}
- info['job_runtime'] = '%dh %02dm %02ds' % \
- (hours, minutes, seconds)
info['source_link'] = '/source/%s/%s/%s' % \
(job.group.name, job.source.name, job.source.version)
info['binary_link'] = '/job/%s/%s/%s/%d' % \
(job.group.name, job.binary.name, job.binary.version, job.binary.build_job_id) if (job.binary and job.binary.build_job_id) else None
- info['builder_link'] = "/builder/%s" % job.builder.name
+ info['builder_link'] = "/builder/%s" % job.builder.name if job.builder else None
+
+ info['job_runtime'] = None
+ if job.finished_at and job.assigned_at:
+ time_diff = job.finished_at - job.assigned_at
+ hours, remainder = divmod(time_diff.total_seconds(), 3600)
+ minutes, seconds = divmod(remainder, 60)
+ info['job_runtime'] = '%dh %02dm %02ds' % \
+ (hours, minutes, seconds)
info['dud_name'] = "%d.dud" % job.id
info['log_name'] = "%d.log" % job.id
diff --git a/templates/job.html b/templates/job.html
index 72e6ee7..1f6ef69 100644
--- a/templates/job.html
+++ b/templates/job.html
@@ -55,6 +55,8 @@
<div class='desc_key'>Builder</div>
<div class='desc_value'><a href='{{info.builder_link}}'>{{job.builder.name}}</a></div>
</div>
+ {% endif %}
+ {% if info.job_runtime %}
<div class='desc_line'>
<div class='desc_key'>Build time</div>
<div class='desc_value'>{{info.job_runtime}}</div>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-web.git
More information about the Pkg-debile-commits
mailing list