From 1da3aac896b85d96805e8105c9a58d42d57d74fc Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 17 Aug 2021 11:15:21 +0200 Subject: [PATCH] fix "," in reminder --- src/utils/time.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/utils/time.py b/src/utils/time.py index 6ef3293..fba8ad4 100644 --- a/src/utils/time.py +++ b/src/utils/time.py @@ -71,20 +71,17 @@ def timedeltaToString(time): day -= year * 365 # suppression des années dans le nombre de jour week = day // 7 # ajout du nombres de semaines day -= week * 7 # suppression des semaines dans le nombre du jour - yearINT = year # besoin pour le message age[0] final year = f"{year} an{'s' if year > 1 else ''}" if year > 0 else "" - weekINT = week # besoin pour le message age[0] final 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 "" - age[0] = f"{year}{', ' if yearINT > 0 else ''}{week}{', ' if weekINT > 0 else ''}{day}" + _ageTemp = [year, week, day] + age[0] = ', '.join(list(set(_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 '' - while "" in age: - age.remove("") - return ', '.join(age).strip(' ') + 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(' ') def getAge(date): """Décompose la différence entre une date et maintenant avec les bons timezone"""