Download:
child 35:d0d03f67dc1f
parent 33:640477d35e0b
34:0a5f37c8562d
Anton Shestakov <av6@dwimlabs.net>, Fri, 17 Jun 2016 21:21:13 +0800
viewer: don't show "0 sec" in get_duration() if check took exactly X minute(s)

1 файлов изменено, 5 вставок(+), 3 удалений(-) [+]
candolint/models.py file | annotate | diff | comparison | revisions
--- a/candolint/models.py Fri Jun 17 19:09:13 2016 +0800
+++ b/candolint/models.py Fri Jun 17 21:21:13 2016 +0800
@@ -88,7 +88,9 @@
def get_duration(self):
d = self.finished - self.started
minutes, seconds = divmod(int(d.total_seconds()), 60)
+ result = []
if minutes:
- return '{} min {} sec'.format(minutes, seconds)
- else:
- return '{} sec'.format(seconds)
+ result.append('{} min'.format(minutes))
+ if seconds or not minutes:
+ result.append('{} sec'.format(seconds))
+ return ' '.join(result)