We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Ajouter les unités temporelles sur les graphs des stats
Cete amélioration est demandée par un auteur :  

>  Ce serait bien, aussi, de mettre les unités à côté du temps. Parce que là, j’ai 03:51, mais je ne sais pas si c’est min:sec ou sec:mil

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `zds/utils/templatetags/seconds_to_duration.py`
Content:
```
1 from django import template
2 import datetime
3 
4 register = template.Library()
5 
6 
7 # TODO add unit test
8 @register.filter('seconds_to_duration')
9 def seconds_to_duration(value):
10     """
11     Display a human-readable reading-time (or any other duration)
12     from a duration in seconds.
13     """
14     if value <= 0:
15         return ''
16 
17     duration = datetime.timedelta(seconds=value)
18     return str(duration)
19
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/zds/utils/templatetags/seconds_to_duration.py b/zds/utils/templatetags/seconds_to_duration.py
--- a/zds/utils/templatetags/seconds_to_duration.py
+++ b/zds/utils/templatetags/seconds_to_duration.py
@@ -4,6 +4,14 @@
 register = template.Library()
 
 
+# https://stackoverflow.com/a/8907269/2226755
+def strfdelta(tdelta, fmt):
+    d = {'days': tdelta.days}
+    d['hours'], rem = divmod(tdelta.seconds, 3600)
+    d['minutes'], d['seconds'] = divmod(rem, 60)
+    return fmt.format(**d)
+
+
 # TODO add unit test
 @register.filter('seconds_to_duration')
 def seconds_to_duration(value):
@@ -15,4 +23,7 @@
         return ''
 
     duration = datetime.timedelta(seconds=value)
-    return str(duration)
+    if duration < 3600
+        return strfdelta(duration, '{minutes}m{seconds}s')
+    else
+        return strfdelta(duration, '{hours}h{minutes}m{seconds}s')

{"golden_diff": "diff --git a/zds/utils/templatetags/seconds_to_duration.py b/zds/utils/templatetags/seconds_to_duration.py\n--- a/zds/utils/templatetags/seconds_to_duration.py\n+++ b/zds/utils/templatetags/seconds_to_duration.py\n@@ -4,6 +4,14 @@\n register = template.Library()\n \n \n+# https://stackoverflow.com/a/8907269/2226755\n+def strfdelta(tdelta, fmt):\n+    d = {'days': tdelta.days}\n+    d['hours'], rem = divmod(tdelta.seconds, 3600)\n+    d['minutes'], d['seconds'] = divmod(rem, 60)\n+    return fmt.format(**d)\n+\n+\n # TODO add unit test\n @register.filter('seconds_to_duration')\n def seconds_to_duration(value):\n@@ -15,4 +23,7 @@\n         return ''\n \n     duration = datetime.timedelta(seconds=value)\n-    return str(duration)\n+    if duration < 3600\n+        return strfdelta(duration, '{minutes}m{seconds}s')\n+    else\n+        return strfdelta(duration, '{hours}h{minutes}m{seconds}s')\n", "issue": "Ajouter les unit\u00e9s temporelles sur les graphs des stats\nCete am\u00e9lioration est demand\u00e9e par un auteur :  \r\n\r\n>  Ce serait bien, aussi, de mettre les unit\u00e9s \u00e0 c\u00f4t\u00e9 du temps. Parce que l\u00e0, j\u2019ai 03:51, mais je ne sais pas si c\u2019est min:sec ou sec:mil\n", "before_files": [{"content": "from django import template\nimport datetime\n\nregister = template.Library()\n\n\n# TODO add unit test\n@register.filter('seconds_to_duration')\ndef seconds_to_duration(value):\n    \"\"\"\n    Display a human-readable reading-time (or any other duration)\n    from a duration in seconds.\n    \"\"\"\n    if value <= 0:\n        return ''\n\n    duration = datetime.timedelta(seconds=value)\n    return str(duration)\n", "path": "zds/utils/templatetags/seconds_to_duration.py"}], "after_files": [{"content": "from django import template\nimport datetime\n\nregister = template.Library()\n\n\n# https://stackoverflow.com/a/8907269/2226755\ndef strfdelta(tdelta, fmt):\n    d = {'days': tdelta.days}\n    d['hours'], rem = divmod(tdelta.seconds, 3600)\n    d['minutes'], d['seconds'] = divmod(rem, 60)\n    return fmt.format(**d)\n\n\n# TODO add unit test\n@register.filter('seconds_to_duration')\ndef seconds_to_duration(value):\n    \"\"\"\n    Display a human-readable reading-time (or any other duration)\n    from a duration in seconds.\n    \"\"\"\n    if value <= 0:\n        return ''\n\n    duration = datetime.timedelta(seconds=value)\n    if duration < 3600\n        return strfdelta(duration, '{minutes}m{seconds}s')\n    else\n        return strfdelta(duration, '{hours}h{minutes}m{seconds}s') \n", "path": "zds/utils/templatetags/seconds_to_duration.py"}]}