Skip to content
Snippets Groups Projects
Commit eea261b3 authored by Briggs, Aaron Shane's avatar Briggs, Aaron Shane
Browse files

fix for issue of not add parameter code to state urls

parent 7bfd89a8
No related branches found
No related tags found
No related merge requests found
......@@ -139,11 +139,11 @@ const retrieveIVTimeSeries = function(siteno) {
* @param {Number} endTime - in epoch milliseconds
* @return {Function} which when dispatched returns a Promise
*/
const retrieveCompareIVTimeSeries = function(siteno, period, startTime, endTime) {
const retrieveCompareIVTimeSeries = function(siteno, period, startTime, endTime, parameterCode) {
return function(dispatch, getState) {
const tsRequestKey = getTsRequestKey('compare', period)(getState());
dispatch(ivTimeSeriesStateActions.addIVTimeSeriesToLoadingKeys([tsRequestKey]));
return getPreviousYearTimeSeries({site: siteno, startTime, endTime}).then(
return getPreviousYearTimeSeries({site: siteno, startTime, endTime, parameterCode}).then(
series => {
const collection = normalize(series, tsRequestKey);
dispatch(Actions.addIVTimeSeriesCollection(collection));
......@@ -186,7 +186,7 @@ const retrieveCustomTimePeriodIVTimeSeries = function(siteno, parameterCd, perio
if (isPeriodCustom(period)) {
dispatch(ivTimeSeriesStateActions.setUserInputsForSelectingTimespan('numberOfDaysFieldValue', parsedPeriodCodes.numberOfDaysFieldValue));
}
dispatch(ivTimeSeriesStateActions.addIVTimeSeriesToLoadingKeys([tsRequestKey]));
return getTimeSeries({sites: [siteno], params: [parameterCd], period: period}).then(
......@@ -295,7 +295,7 @@ const retrieveExtendedIVTimeSeries = function(siteno, period, paramCd=null) {
}).then(
series => {
const collection = normalize(series, tsRequestKey);
dispatch(Actions.retrieveCompareIVTimeSeries(siteno, period, startTime, endTime));
dispatch(Actions.retrieveCompareIVTimeSeries(siteno, period, startTime, endTime, thisParamCd));
dispatch(Actions.addIVTimeSeriesCollection(collection));
dispatch(ivTimeSeriesStateActions.removeIVTimeSeriesFromLoadingKeys([tsRequestKey]));
},
......
import {utcFormat} from 'd3-time-format';
import {get} from 'ui/ajax';
import config from 'ui/config';
import {get} from 'ui/ajax';
// Define Water Services root URL - use global variable if defined, otherwise
// use production.
......@@ -64,13 +63,15 @@ export const getTimeSeries = function({sites, params=null, startDate=null, endDa
});
};
export const getPreviousYearTimeSeries = function({site, startTime, endTime}) {
export const getPreviousYearTimeSeries = function({site, startTime, endTime, parameterCode}) {
parameterCode = parameterCode ? [parameterCode] : null;
let lastYearStartTime = new Date(startTime);
let lastYearEndTime = new Date(endTime);
lastYearStartTime.setFullYear(lastYearStartTime.getFullYear() - 1);
lastYearEndTime.setFullYear(lastYearEndTime.getFullYear() - 1);
return getTimeSeries({sites: [site], startDate: lastYearStartTime, endDate: lastYearEndTime});
return getTimeSeries({sites: [site], startDate: lastYearStartTime, endDate: lastYearEndTime, params: parameterCode});
};
export const queryWeatherService = function(latitude, longitude) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment