From 131e82502de6995f4725bcd2137d7ab218759647 Mon Sep 17 00:00:00 2001 From: Jose Contreras Date: Thu, 6 Sep 2018 10:52:42 -0400 Subject: [PATCH] Fix issue with to date not being in state. --- src/containers/Sensors/SensorGraph.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/containers/Sensors/SensorGraph.js b/src/containers/Sensors/SensorGraph.js index 06574577..b690dd4d 100644 --- a/src/containers/Sensors/SensorGraph.js +++ b/src/containers/Sensors/SensorGraph.js @@ -45,7 +45,7 @@ export class SensorGraph extends Component { latestReadings: {}, timerange: new TimeRange([subtractDaysFromNow(this.NUM_DAYS - 1), today]), from: subtractDaysFromNow(this.NUM_DAYS), - today, + to: today, lineStyles: {}, collapseLatest: false, activeTab: '', @@ -60,14 +60,14 @@ export class SensorGraph extends Component { nodes: '', data: '', from: this.state.from.toUTCString(), - to: this.state.today.toUTCString(), + to: this.state.to.toUTCString(), }); this.props.loadWeather({ measurement: 'temperature', interval: 'hourly', location: 'New_York:NY', date_start: moment(this.state.from).format('YYYY-MM-DD hh:mm:ss'), - date_end: moment(this.state.today).format('YYYY-MM-DD hh:mm:ss'), + date_end: moment(this.state.to).format('YYYY-MM-DD hh:mm:ss'), }); } @@ -94,7 +94,7 @@ export class SensorGraph extends Component { const lines = sensorData.filter(gateway => ( (!gateway.data && gateway.nodes.length > 0) || gateway.data.length > 0 )).reduce((acc, gateway) => { - // Handle awair differently + // Handle awair nodes differently if (gateway.sensor_type === SENSOR_TYPES.awair) { const timeSeriesData = this.generateTimeSeriesFromSensor(gateway, props); Object.keys(timeSeriesData.timeseries).map((key) => { @@ -147,7 +147,6 @@ export class SensorGraph extends Component { latestReadings[ timeSeriesData.latestReading.id ] = timeSeriesData.latestReading.reading; - // Handle boiler nodes differently } return oneNode; }); @@ -408,7 +407,7 @@ export class SensorGraph extends Component { interval: 'hourly', location: 'New_York:NY', date_start: moment(from).format('YYYY-MM-DD hh:mm:ss'), - date_end: moment(this.state.today).format('YYYY-MM-DD hh:mm:ss'), + date_end: moment(this.state.to).format('YYYY-MM-DD hh:mm:ss'), }); }, 500); -- GitLab