Fixing hourly
This commit is contained in:
@@ -45,7 +45,7 @@ export async function queryHourly(start, end) {
|
||||
results.forEach(r => {
|
||||
r.values.forEach(([ts, val]) => {
|
||||
if(r.metric.__name__.startsWith('system_')) return;
|
||||
const time = new Date(ts * 1000).toISOString().slice(0, 13) + ':00';
|
||||
const time = new Date(ts * 1000);
|
||||
if (!byTime[time]) byTime[time] = {time};
|
||||
byTime[time][r.metric.__name__.replace('weather_', '')] = parseFloat(val);
|
||||
});
|
||||
@@ -68,7 +68,7 @@ export async function queryDaily(start, end) {
|
||||
means.forEach(r => {
|
||||
r.values.forEach(([ts, val]) => {
|
||||
if(r.metric.__name__.startsWith('system_')) return;
|
||||
const time = new Date(ts * 1000).toISOString().slice(0, 10);
|
||||
const time = new Date(ts * 1000);
|
||||
if (!byTime[time]) byTime[time] = {time};
|
||||
byTime[time][r.metric.__name__.replace('weather_', '')] = parseFloat(val);
|
||||
});
|
||||
@@ -77,7 +77,7 @@ export async function queryDaily(start, end) {
|
||||
mins.forEach(r => {
|
||||
if (r.metric.__name__ !== 'temperature') return;
|
||||
r.values.forEach(([ts, val]) => {
|
||||
const time = new Date(ts * 1000).toISOString().slice(0, 10);
|
||||
const time = new Date(ts * 1000);
|
||||
if (!byTime[time]) byTime[time] = {time};
|
||||
byTime[time].env_temp_min_c = parseFloat(val);
|
||||
});
|
||||
@@ -86,7 +86,7 @@ export async function queryDaily(start, end) {
|
||||
maxs.forEach(r => {
|
||||
if (r.metric.__name__ !== 'temperature') return;
|
||||
r.values.forEach(([ts, val]) => {
|
||||
const time = new Date(ts * 1000).toISOString().slice(0, 10);
|
||||
const time = new Date(ts * 1000);
|
||||
if (!byTime[time]) byTime[time] = {time};
|
||||
byTime[time].env_temp_max_c = parseFloat(val);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user