Commit 1a416249 authored by Dan Pascu's avatar Dan Pascu

Improved displaying call duration in the history menus

parent 0a7f3ec4
...@@ -131,13 +131,13 @@ class HistoryEntry(object): ...@@ -131,13 +131,13 @@ class HistoryEntry(object):
else: else:
result += self.call_time.strftime(" on %Y-%m-%d") result += self.call_time.strftime(" on %Y-%m-%d")
if self.duration: if self.duration:
result += ' for ' seconds = int(self.duration.total_seconds())
if self.duration.days > 0 or self.duration.seconds > 3600: if seconds >= 3600:
result += '%i hours, ' % (self.duration.days*24 + int(self.duration.seconds/3600)) result += """ (%dh%02d'%02d")""" % (seconds / 3600, (seconds % 3600) / 60, seconds % 60)
secs = self.duration.seconds % 3600 else:
result += '%02i:%02i' % (int(secs/60), secs % 60) result += """ (%d'%02d")""" % (seconds / 60, seconds % 60)
if self.reason: elif self.reason:
result += ' %s' % self.reason.title() result += ' (%s)' % self.reason.title()
return result return result
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment