From c5823d8fa7bf0e180a0f92a604aeb2e4dc4d85d5 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 8 Jun 2021 00:22:01 +0200 Subject: [PATCH] =?UTF-8?q?moins=20de=20r=C3=A9p=C3=A9tition=20+=20afficha?= =?UTF-8?q?ge=20plus=20coh=C3=A9rent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/time.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/utils/time.py b/src/utils/time.py index 10950f6..39f4c30 100644 --- a/src/utils/time.py +++ b/src/utils/time.py @@ -90,18 +90,13 @@ def ageLayout(tuple): if tuple[i] > 1 and i != 1: time[i] = time[i] + "s" message = "" - if tuple[5] > 0: # pour les secondes - affichage = [5] # on affiche que : seconde + if tuple[5] > 0: + affichage = [5] if tuple[4] > 0: - affichage = [4, 5] # on affiche : minute + seconde - if tuple[3] > 0: - affichage = [3, 4, 5] # on affiche : heure + minute + seconde - if tuple[2] > 0: - affichage = [2, 3, 4] # on affiche : jour + heure + minute - if tuple[1] > 0: - affichage = [1, 2, 3] # on affiche : mois + jour + heure - if tuple[0] > 0: - affichage = [0, 1, 3] # on affiche : an + mois + heure + affichage = [4, 5] + for i in [3, 0]: + if tuple[i] > 0: + affichage = [i, i + 1, i + 2] for i in affichage: message = message + f", {tuple[i]} {time[i]}" return message[2:]