Replace dictionary with list
This commit is contained in:
parent
0756c85179
commit
863a33c2cd
1 changed files with 9 additions and 10 deletions
|
@ -76,13 +76,13 @@ def generate(templatedir, destinationdir, templateFilename):
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find trimmedRunsInCategory by only including one run per runner from sortedRunsInCategory
|
# Find trimmedRunsInCategory by only including one run per runner from sortedRunsInCategory
|
||||||
trimmedRunsInCategory = {}
|
trimmedRunsInCategory = []
|
||||||
runnersRepresentedInCategory = []
|
runnersRepresentedInCategory = []
|
||||||
for run in sortedRunsInCategory:
|
for run in sortedRunsInCategory:
|
||||||
thisRun = runs[run]
|
thisRun = runs[run]
|
||||||
runner = thisRun["tk_run_runner"]
|
runner = thisRun["tk_run_runner"]
|
||||||
if runner not in runnersRepresentedInCategory:
|
if runner not in runnersRepresentedInCategory:
|
||||||
trimmedRunsInCategory[thisRun["tk_run_id"]] = thisRun
|
trimmedRunsInCategory.append(thisRun)
|
||||||
runnersRepresentedInCategory.append(runner)
|
runnersRepresentedInCategory.append(runner)
|
||||||
|
|
||||||
# Replace lk_leaderboard with category leaderboard table
|
# Replace lk_leaderboard with category leaderboard table
|
||||||
|
@ -91,19 +91,18 @@ def generate(templatedir, destinationdir, templateFilename):
|
||||||
for run in trimmedRunsInCategory:
|
for run in trimmedRunsInCategory:
|
||||||
|
|
||||||
# Define values for table
|
# Define values for table
|
||||||
thisRun = trimmedRunsInCategory[run]
|
runner = run["tk_run_runner"]
|
||||||
thisRunner = thisRun["tk_run_runner"]
|
runId = run["tk_run_id"]
|
||||||
thisRunId = thisRun["tk_run_id"]
|
runLink = f"../../runs/{runId}"
|
||||||
thisLink = f"../../runs/{thisRunId}"
|
runDuration = str(runDurationsInCategory[runId])
|
||||||
thisDuration = str(runDurationsInCategory[thisRunId])
|
runDate = run["tk_run_date"]
|
||||||
thisDate = thisRun["tk_run_date"]
|
|
||||||
|
|
||||||
# Concatenate a row to the table
|
# Concatenate a row to the table
|
||||||
lk_leaderboard += f'<tr><th>{place}.</th><th>{thisRunner}</th><th><a href="{thisLink}">{thisDuration}</a></th><th>{thisDate}</th></tr>'
|
lk_leaderboard += f'<tr><th>{place}.</th><th>{runner}</th><th><a href="{runLink}">{runDuration}</a></th><th>{runDate}</th></tr>'
|
||||||
|
|
||||||
# Also handle replacing lk_run_place on run pages
|
# Also handle replacing lk_run_place on run pages
|
||||||
util_file.replaceTextInFile(
|
util_file.replaceTextInFile(
|
||||||
f"{destinationdir}/../runs/{thisRunId}/index.html",
|
f"{destinationdir}/../runs/{runId}/index.html",
|
||||||
"lk_run_place",
|
"lk_run_place",
|
||||||
str(place),
|
str(place),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue