From e28587fee9e05a6c258d65c6618ef66707af7519 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 18 Aug 2021 21:49:56 +0200 Subject: [PATCH] fixed a problem that mixed timings --- src/utils/time.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/time.py b/src/utils/time.py index fba8ad4..da495cc 100644 --- a/src/utils/time.py +++ b/src/utils/time.py @@ -75,13 +75,17 @@ def timedeltaToString(time): week = f"{week} semaine{'s' if week > 1 else ''}" if week > 0 else "" day = f"{day} jour{'s' if day > 1 else ''}" if day > 0 else "" _ageTemp = [year, week, day] - age[0] = ', '.join(list(set(_ageTemp) - {""})).strip(' ') + while "" in _ageTemp: + _ageTemp.remove("") + age[0] = ', '.join(_ageTemp).strip(' ') else: age[0] = "" age[1] = f"{age[1]}h" if affichage[1] == 1 else "" age[2] = f"{age[2]}m" if affichage[2] == 1 else "" age[3] = f"{age[3]}s" if affichage[3] == 1 else "" - return ', '.join(list(set(age) - {""})).strip(' ') + while "" in age: + age.remove("") + return ', '.join(age).strip(' ') def getAge(date): """Décompose la différence entre une date et maintenant avec les bons timezone"""