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
|
//#endregion CALENDAR
|
||||||
|
|
||||||
const next12Hours = Object.entries(weather.hours).slice(1, 13)
|
const next12Hours = Object.entries(weather.hours).slice(1, 22)
|
||||||
|
|
||||||
const minTemp =
|
const minTemp =
|
||||||
Math.min(...next12Hours.map(([, h]) => h.temperature as number)) - 5
|
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) {
|
for (const [offset, hour] of next12Hours) {
|
||||||
|
const offsetInt = +offset
|
||||||
|
|
||||||
const x = Math.floor(
|
const x = Math.floor(
|
||||||
tempX +
|
tempX +
|
||||||
tempGraphP +
|
tempGraphP +
|
||||||
(+offset - 1) * (tempGraphW / next12Hours.length),
|
(offsetInt - 1) * (tempGraphW / next12Hours.length),
|
||||||
)
|
)
|
||||||
|
|
||||||
const y = tempY
|
const y = tempY
|
||||||
const temperature = hour.temperature as number
|
const temperature = hour.temperature as number
|
||||||
const ratio = (temperature - minTemp) / tempRange
|
const ratio = (temperature - minTemp) / tempRange
|
||||||
const height = Math.floor(50 * ratio)
|
const height = Math.floor(50 * ratio)
|
||||||
const t = now.plus({ hours: +offset }).hour
|
const t = now.plus({ hours: offsetInt }).hour
|
||||||
|
|
||||||
widgets.push({
|
widgets.push({
|
||||||
x: x + 7,
|
x: x + 7,
|
||||||
|
|
@ -279,15 +281,17 @@ export const dowRoutes = router((router, ctx) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets.push({
|
if ((offsetInt - 1) % 2 === 0) {
|
||||||
x: x + 10,
|
widgets.push({
|
||||||
y: y + 60,
|
x: x + 10,
|
||||||
c: t.toString().padStart(2, '0'),
|
y: y + 60,
|
||||||
t: TYPES.TEXT,
|
c: t.toString().padStart(2, '0'),
|
||||||
va: ALIGN.START,
|
t: TYPES.TEXT,
|
||||||
ha: ALIGN.CENTER,
|
va: ALIGN.START,
|
||||||
f: 3,
|
ha: ALIGN.CENTER,
|
||||||
})
|
f: 3,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const minPre = Math.min(
|
const minPre = Math.min(
|
||||||
|
|
@ -335,15 +339,17 @@ export const dowRoutes = router((router, ctx) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
for (const [offset, hour] of next12Hours) {
|
for (const [offset, hour] of next12Hours) {
|
||||||
|
const offsetInt = +offset
|
||||||
|
|
||||||
const x = Math.floor(
|
const x = Math.floor(
|
||||||
preX + preGraphP + (+offset - 1) * (preGraphW / next12Hours.length),
|
preX + preGraphP + (offsetInt - 1) * (preGraphW / next12Hours.length),
|
||||||
)
|
)
|
||||||
|
|
||||||
const y = preY
|
const y = preY
|
||||||
const pre = hour.precipitationAmount as number
|
const pre = hour.precipitationAmount as number
|
||||||
const ratio = (pre - minPre) / preRange
|
const ratio = (pre - minPre) / preRange
|
||||||
const height = Math.floor(50 * ratio)
|
const height = Math.floor(50 * ratio)
|
||||||
const t = now.plus({ hours: +offset }).hour
|
const t = now.plus({ hours: offsetInt }).hour
|
||||||
|
|
||||||
widgets.push({
|
widgets.push({
|
||||||
x: x + 7,
|
x: x + 7,
|
||||||
|
|
@ -365,15 +371,17 @@ export const dowRoutes = router((router, ctx) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets.push({
|
if ((offsetInt - 1) % 2 === 0) {
|
||||||
x: x + 10,
|
widgets.push({
|
||||||
y: y + 60,
|
x: x + 10,
|
||||||
c: t.toString().padStart(2, '0'),
|
y: y + 60,
|
||||||
t: TYPES.TEXT,
|
c: t.toString().padStart(2, '0'),
|
||||||
va: ALIGN.START,
|
t: TYPES.TEXT,
|
||||||
ha: ALIGN.CENTER,
|
va: ALIGN.START,
|
||||||
f: 3,
|
ha: ALIGN.CENTER,
|
||||||
})
|
f: 3,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(widgets)
|
res.json(widgets)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue