diff --git a/fittrackee_api/fittrackee_api/users/utils.py b/fittrackee_api/fittrackee_api/users/utils.py index 2c8c6f6f..e6b08eb7 100644 --- a/fittrackee_api/fittrackee_api/users/utils.py +++ b/fittrackee_api/fittrackee_api/users/utils.py @@ -153,9 +153,9 @@ def display_readable_file_size(size_in_bytes): def get_readable_duration(duration, locale='en'): - if locale != 'en': + if locale is not None and locale != 'en': _t = humanize.i18n.activate(locale) # noqa readable_duration = humanize.naturaldelta(timedelta(seconds=duration)) - if locale != 'en': + if locale is not None and locale != 'en': humanize.i18n.deactivate() return readable_duration