Leading zeroes

main
Bob Mottram 2021-10-30 20:23:51 +01:00
parent dcc86e5279
commit ace5cafa6d
2 changed files with 3 additions and 7 deletions

View File

@ -11973,7 +11973,8 @@ class PubServer(BaseHTTPRequestHandler):
recentCrawlers = 60 * 60 * 24 * 30
for uaStr, item in knownCrawlers.items():
if item['lastseen'] - currTime < recentCrawlers:
crawlersList.append(str(item['hits']) + ' ' + uaStr)
hitsStr = str(item['hits']).zfill(8)
crawlersList.append(hitsStr + ' ' + uaStr)
crawlersList.sort(reverse=True)
msg = ''
for lineStr in crawlersList:

View File

@ -58,12 +58,7 @@ def sortedWatchPoints(fitness: {}, fitnessId: str) -> []:
if not item.get('total'):
continue
averageTime = item['total'] * 1000 / item['ctr']
averageTimeStr = str(averageTime)
threshold = 10
while threshold < 100000:
if averageTime < threshold:
averageTimeStr = '0' + averageTimeStr
threshold *= 10
averageTimeStr = str(averageTime).zfill(8)
result.append(averageTimeStr + ' ' + watchPoint)
result.sort(reverse=True)
return result