From 45a02233fbd838ac1bb2f332dcc9f958e8a02a1f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 20 Oct 2021 16:48:19 +0100 Subject: [PATCH] Leading zeroes --- fitnessFunctions.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fitnessFunctions.py b/fitnessFunctions.py index f0fe8bcf1..e27dbd181 100644 --- a/fitnessFunctions.py +++ b/fitnessFunctions.py @@ -57,8 +57,18 @@ def sortedWatchPoints(fitness: {}, fitnessId: str) -> []: for watchPoint, item in fitness['performance'][fitnessId].items(): if not item.get('total'): continue - averageTime = item['total'] * 1000 / item['ctr'] - result.append(str(averageTime) + ' ' + watchPoint) + averageTimeStr = str(item['total'] * 1000 / item['ctr']) + if item['total'] < 10: + averageTimeStr = '0' + averageTimeStr + if item['total'] < 100: + averageTimeStr = '0' + averageTimeStr + if item['total'] < 1000: + averageTimeStr = '0' + averageTimeStr + if item['total'] < 10000: + averageTimeStr = '0' + averageTimeStr + if item['total'] < 100000: + averageTimeStr = '0' + averageTimeStr + result.append(averageTimeStr + ' ' + watchPoint) result.sort(reverse=True) return result