More hourse
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
a7b1e659e8
commit
f50abec60f
|
|
@ -202,7 +202,7 @@ export const dowRoutes = router((router, ctx) => {
|
|||
|
||||
//#endregion CALENDAR
|
||||
|
||||
const next12Hours = Object.entries(weather.hours).slice(1, 13)
|
||||
const next12Hours = Object.entries(weather.hours).slice(1, 22)
|
||||
|
||||
const minTemp =
|
||||
Math.min(...next12Hours.map(([, h]) => h.temperature as number)) - 5
|
||||
|
|
@ -247,17 +247,19 @@ export const dowRoutes = router((router, ctx) => {
|
|||
})
|
||||
|
||||
for (const [offset, hour] of next12Hours) {
|
||||
const offsetInt = +offset
|
||||
|
||||
const x = Math.floor(
|
||||
tempX +
|
||||
tempGraphP +
|
||||
(+offset - 1) * (tempGraphW / next12Hours.length),
|
||||
(offsetInt - 1) * (tempGraphW / next12Hours.length),
|
||||
)
|
||||
|
||||
const y = tempY
|
||||
const temperature = hour.temperature as number
|
||||
const ratio = (temperature - minTemp) / tempRange
|
||||
const height = Math.floor(50 * ratio)
|
||||
const t = now.plus({ hours: +offset }).hour
|
||||
const t = now.plus({ hours: offsetInt }).hour
|
||||
|
||||
widgets.push({
|
||||
x: x + 7,
|
||||
|
|
@ -279,6 +281,7 @@ export const dowRoutes = router((router, ctx) => {
|
|||
})
|
||||
}
|
||||
|
||||
if ((offsetInt - 1) % 2 === 0) {
|
||||
widgets.push({
|
||||
x: x + 10,
|
||||
y: y + 60,
|
||||
|
|
@ -289,6 +292,7 @@ export const dowRoutes = router((router, ctx) => {
|
|||
f: 3,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const minPre = Math.min(
|
||||
...next12Hours.map(([, h]) => h.precipitationAmount as number),
|
||||
|
|
@ -335,15 +339,17 @@ export const dowRoutes = router((router, ctx) => {
|
|||
})
|
||||
|
||||
for (const [offset, hour] of next12Hours) {
|
||||
const offsetInt = +offset
|
||||
|
||||
const x = Math.floor(
|
||||
preX + preGraphP + (+offset - 1) * (preGraphW / next12Hours.length),
|
||||
preX + preGraphP + (offsetInt - 1) * (preGraphW / next12Hours.length),
|
||||
)
|
||||
|
||||
const y = preY
|
||||
const pre = hour.precipitationAmount as number
|
||||
const ratio = (pre - minPre) / preRange
|
||||
const height = Math.floor(50 * ratio)
|
||||
const t = now.plus({ hours: +offset }).hour
|
||||
const t = now.plus({ hours: offsetInt }).hour
|
||||
|
||||
widgets.push({
|
||||
x: x + 7,
|
||||
|
|
@ -365,6 +371,7 @@ export const dowRoutes = router((router, ctx) => {
|
|||
})
|
||||
}
|
||||
|
||||
if ((offsetInt - 1) % 2 === 0) {
|
||||
widgets.push({
|
||||
x: x + 10,
|
||||
y: y + 60,
|
||||
|
|
@ -375,6 +382,7 @@ export const dowRoutes = router((router, ctx) => {
|
|||
f: 3,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
res.json(widgets)
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue