Download:
child 28:46b429c6500d
parent 26:8c1ce7d12350
27:9fa79edc2e45
Anton Shestakov <av6@dwimlabs.net>, Thu, 16 Jun 2016 07:31:39 +0800
viewer: use new get_duration() method to format time taken by a check

4 файлов изменено, 11 вставок(+), 3 удалений(-) [+]
candolint/models.py file | annotate | diff | comparison | revisions
templates/check.html file | annotate | diff | comparison | revisions
templates/index.html file | annotate | diff | comparison | revisions
templates/project.html file | annotate | diff | comparison | revisions
--- a/candolint/models.py Wed Jun 15 23:49:22 2016 +0800
+++ b/candolint/models.py Thu Jun 16 07:31:39 2016 +0800
@@ -84,3 +84,11 @@
def get_url(self, request=None):
return '{}/{}'.format(self.project.get_url(request), self.ordinal)
+
+ def get_duration(self):
+ d = self.finished - self.started
+ minutes, seconds = divmod(int(d.total_seconds()), 60)
+ if minutes:
+ return '{} min {} sec'.format(minutes, seconds)
+ else:
+ return '{} sec'.format(seconds)
--- a/templates/check.html Wed Jun 15 23:49:22 2016 +0800
+++ b/templates/check.html Thu Jun 16 07:31:39 2016 +0800
@@ -24,7 +24,7 @@
<dt>Finished:</dt>
<dd>{% module Time(check.finished) %}</dd>
<dt>Duration:</dt>
- <dd>{{ check.finished - check.started }}</dd>
+ <dd>{{ check.get_duration() }}</dd>
</dl>
</div>
<div class="uk-width-medium-2-3">
--- a/templates/index.html Wed Jun 15 23:49:22 2016 +0800
+++ b/templates/index.html Thu Jun 16 07:31:39 2016 +0800
@@ -17,7 +17,7 @@
<td>{{ change.rev }}:{{ change.node[:12] }} {{ change.branch }}</td>
<td>{% module Time(check.started) %}</td>
<td>{% module Time(check.finished) %}</td>
- <td>{{ check.finished - check.started }}</td>
+ <td>{{ check.get_duration() }}</td>
</tr>
{% end %}
</tbody>
--- a/templates/project.html Wed Jun 15 23:49:22 2016 +0800
+++ b/templates/project.html Thu Jun 16 07:31:39 2016 +0800
@@ -25,7 +25,7 @@
</td>
<td>{% module Time(check.started) %}</td>
<td>{% module Time(check.finished) %}</td>
- <td>{{ check.finished - check.started }}</td>
+ <td>{{ check.get_duration() }}</td>
</tr>
{% end %}
</tbody>