🍪🍰 Checkpoint

./public/index.js:1954897/59330
This commit is contained in:
Glitch (glitch-hello-node)
2021-11-14 16:37:38 +00:00
parent 68da9a962d
commit 3869d19029
2 changed files with 18 additions and 12 deletions
+13
View File
@@ -435,3 +435,16 @@ ECSW,1636907151813,2
ECSW,1636907165563,2
ECSW,1636907179017,2
ECSW,1636907193061,2
ECSW,1636907211474,2
ECSW,1636907224730,2
ECSW,1636907238242,2
ECSW,1636907252062,2
ECSW,1636907265754,2
ECSW,1636907278967,2
ECSW,1636907291981,3
ECSW,1636907305097,2
ECSW,1636907795564,3
ECSW,1636907809605,4
ECSW,1636907823324,4
ECSW,1636907836309,3
ECSW,1636907851878,4
1 ECSW 1636867215164 2
435 ECSW 1636907165563 2
436 ECSW 1636907179017 2
437 ECSW 1636907193061 2
438 ECSW 1636907211474 2
439 ECSW 1636907224730 2
440 ECSW 1636907238242 2
441 ECSW 1636907252062 2
442 ECSW 1636907265754 2
443 ECSW 1636907278967 2
444 ECSW 1636907291981 3
445 ECSW 1636907305097 2
446 ECSW 1636907795564 3
447 ECSW 1636907809605 4
448 ECSW 1636907823324 4
449 ECSW 1636907836309 3
450 ECSW 1636907851878 4
+5 -12
View File
@@ -35,8 +35,8 @@ const map = L.map('map', {
maxZoom: 18
}).setView([32.98613, -96.75042], 18)
const INTERVAL = 10 * 60 * 1000
const STEP = 2 * 60 * 1000
const INTERVAL = 10 * 60 * 1000 + STEP
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
@@ -89,7 +89,7 @@ async function drawRegions() {
const red = new Color(255, 0, 0)
const green = new Color(0, 255, 0)
console.log({current, max, min})
const color = red.interpolate(green, current / (max - min))
const color = red.interpolate(green, -current / (max - min))
buildings.ECSW.poly.setStyle({ color: color.asRgbCss() })
console.log({avg, current, delta, color})
@@ -144,18 +144,11 @@ async function displayCard(id) {
const current = data[data.length - 1]?.count ?? NaN
const avg = data.reduce((acc, v) => acc + v.count, 0) / data.length
const delta = current - avg
// const min = Math.min(...data.map(d => d.count))
// const max = Math.max(...data.map(d => d.count))
const busy = delta < 0
const busy = 0 < delta
// const red = new Color(255, 0, 0)
// const green = new Color(0, 255, 0)
// const color = red.interpolate(green, current / (max - min))
console.log({busy, avg, current, delta})
console.log(delta)
const msg = Number.isNaN(delta)
? "No data..."
const msg = Number.isNaN(delta) ? "No data..."
: (busy ? "Busier than usual": "Not as busy :)")
card.innerHTML = `