From: Michael Tremer Date: Sun, 17 Feb 2013 17:36:07 +0000 (+0100) Subject: Change format of build time. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7514d7dc9cfad8d3bf475ba750008df125d820e3;p=pbs.git Change format of build time. --- diff --git a/data/templates/modules/jobs/boxes.html b/data/templates/modules/jobs/boxes.html index 4f7f0cfc..21c25344 100644 --- a/data/templates/modules/jobs/boxes.html +++ b/data/templates/modules/jobs/boxes.html @@ -3,7 +3,7 @@

- {{ friendly_time(j.duration) }} ‐ + {{ format_time(j.duration, shorter=True) }} ‐ {% module JobState(j) %} {{ j.arch.name }} diff --git a/data/templates/modules/jobs/list.html b/data/templates/modules/jobs/list.html index d48b58e9..60127e9c 100644 --- a/data/templates/modules/jobs/list.html +++ b/data/templates/modules/jobs/list.html @@ -46,7 +46,7 @@ - {{ friendly_time(job.duration) }} + {{ format_time(job.duration, shorter=True) }} {% if job.is_running() %}
{{ _("ETA") }}: {{ format_eta(job.eta) }} diff --git a/web/__init__.py b/web/__init__.py index b40e5f27..3a493703 100644 --- a/web/__init__.py +++ b/web/__init__.py @@ -313,7 +313,7 @@ class Application(tornado.web.Application): self.format_time_short(handler, stddev), ) - def format_time(self, handler, s): + def format_time(self, handler, s, shorter=False): _ = handler.locale.translate hrs, s = divmod(s, 3600) @@ -322,6 +322,9 @@ class Application(tornado.web.Application): if s >= 30: min += 1 + if shorter and not hrs: + return _("%(min)d min") % { "min" : min } + return _("%(hrs)d:%(min)02d hrs") % {"hrs" : hrs, "min" : min} def format_time_short(self, handler, s):