donate-cpu-server.py: Enhance formatting of latest.html output (#1605)

Column width can now be easily changed via the `column_width` array.
Increased column width for the packages column so it is more likely that the date is not dropped.
Increased the column width for the number of results since there are packages which have about 100000 results.
This commit is contained in:
Sebastian 2019-01-15 11:39:47 +01:00 committed by GitHub
parent a7a0a54557
commit 7281a886e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 14 deletions

View File

@ -32,21 +32,19 @@ def overviewReport():
def fmt(a, b, c, d, e):
ret = a + ' '
while len(ret) < 10:
column_width = [15, 10, 5, 6, 6, 8]
ret = a
while len(ret) < column_width[0]:
ret += ' '
if len(ret) == 10:
ret += b[:10] + ' '
while len(ret) < 21:
if len(ret) == column_width[0]:
ret += ' ' + b[:10]
while len(ret) < (column_width[0] + 1 + column_width[1]):
ret += ' '
ret += b[-5:] + ' '
while len(ret) < 32-len(c):
ret += ' '
ret += c + ' '
while len(ret) < 37-len(d):
ret += ' '
ret += d
ret += ' ' + e
ret += ' '
ret += b[-5:].rjust(column_width[2]) + ' '
ret += c.rjust(column_width[3]) + ' '
ret += d.rjust(column_width[4]) + ' '
ret += e.rjust(column_width[5])
if a != 'Package':
pos = ret.find(' ')
ret = '<a href="' + a + '">' + a + '</a>' + ret[pos:]
@ -55,7 +53,7 @@ def fmt(a, b, c, d, e):
def latestReport(latestResults):
html = '<html><head><title>Latest daca@home results</title></head><body>\n'
html += '<h1>Latest daca@home results</h1>'
html += '<h1>Latest daca@home results</h1>\n'
html += '<pre>\n<b>' + fmt('Package', 'Date Time ', OLD_VERSION, 'Head', 'Diff') + '</b>\n'
# Write report for latest results