Make top-scoring team take full width

This commit is contained in:
Neale Pickett 2019-11-20 16:23:01 -08:00
parent 08f2e95f89
commit 761811d71b
1 changed files with 5 additions and 3 deletions

View File

@ -112,10 +112,14 @@ function scoreboardInit() {
winners.sort(teamCompare) winners.sort(teamCompare)
winners.reverse() winners.reverse()
// Let's make some better names for things we've computed
let winningScore = winners[0].overallScore
let numCategories = Object.keys(highestCategoryScore).length
// Clear out the element we're about to populate // Clear out the element we're about to populate
Array.from(element.childNodes).map(e => e.remove()) Array.from(element.childNodes).map(e => e.remove())
let maxWidth = 100 / Object.keys(highestCategoryScore).length let maxWidth = 100 / winningScore
for (let team of winners) { for (let team of winners) {
let row = document.createElement("div") let row = document.createElement("div")
let ncat = 0 let ncat = 0
@ -125,8 +129,6 @@ function scoreboardInit() {
let catPct = catTeam / catHigh let catPct = catTeam / catHigh
let width = maxWidth * catPct let width = maxWidth * catPct
console.log(catHigh, catTeam, catPct)
let bar = document.createElement("span") let bar = document.createElement("span")
bar.classList.add("category") bar.classList.add("category")
bar.classList.add("cat" + ncat) bar.classList.add("cat" + ncat)