Merge pull request #105 from dirtbags/scoreboard-width

Make top-scoring team take full width
This commit is contained in:
int00h5525 2019-11-20 18:30:07 -06:00 committed by GitHub
commit 04e89c09e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Fixed
- Made top-scoring teams full-width
## [3.4.2] - 2019-11-18 ## [3.4.2] - 2019-11-18
### Fixed ### Fixed

View File

@ -111,11 +111,15 @@ 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)