File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed
piwik/indico_piwik/queries Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change 66# see the LICENSE file for more details.
77
88import json
9+ from datetime import timedelta
910from functools import reduce
1011
1112from flask_pluginengine import current_plugin
1213
14+ from indico .util .date_time import format_human_timedelta
15+
1316
1417def get_json_from_remote_server (func , ** kwargs ):
1518 """
@@ -37,18 +40,6 @@ def reduce_json(data):
3740 return reduce (lambda x , y : int (x ) + int (y ), list (data .values ()))
3841
3942
40- def stringify_seconds (seconds = 0 ):
41- """
42- Takes time as a value of seconds and deduces the delta in human-readable
43- HHh MMm SSs format.
44- """
45- seconds = int (seconds )
46- minutes = seconds / 60
47-
48- h = m = s = 0
49- if seconds > 0 :
50- s = seconds % 60
51- m = minutes % 60
52- h = minutes / 60
53-
54- return f'{ h } h { m } m { s } s'
43+ def stringify_seconds (seconds ):
44+ """Format seconds in a compact HHh MMm SSs format."""
45+ return format_human_timedelta (timedelta (seconds = seconds ), narrow = True )
You can’t perform that action at this time.
0 commit comments