From: Ross Jones Date: Thu, 25 Oct 2012 15:37:53 +0000 Subject: Human readable times X-Git-Url: http://maxious.lambdacomplex.org/git/?p=ckanext-ga-report.git&a=commitdiff&h=882c0822404ab7f9ffe0d4a3e45babbb35c40bad --- Human readable times --- --- a/ckanext/ga_report/controller.py +++ b/ckanext/ga_report/controller.py @@ -65,6 +65,10 @@ val = e.value if e.key in ['Average time on site', 'Pages per visit', 'Percent new visits']: val = "%.2f" % round(float(e.value), 2) + if e.key == 'Average time on site': + mins, secs = divmod(float(val), 60) + hours, mins = divmod(mins, 60) + val = '%02d:%02d:%02d (%s seconds) ' % (hours, mins, secs, val) e.key = '%s *' % e.key c.global_totals.append((e.key, val))