update design bundle

This commit is contained in:
Eric Hulburd
2016-03-11 19:01:59 -06:00
parent 782f5cbf91
commit cdd6f8dc0f
7 changed files with 36 additions and 6 deletions

View File

@@ -3,6 +3,24 @@ import DateRange from './../../../shared/utils/date_range';
class EnergyDataApi {
static index(params){
if (params.houses){
var promises = [],
data = [];
for (var opts of params.houses){
var promise = EnergyDataApi.getHouseData(opts)
.then((res)=>{
data.concat(res);
});
promises.push(promise);
}
return Promise.all(promises)
.then(()=>{ return data; });
} else {
return EnergyDataApi.getHouseData(params);
}
}
static getHouseData(params){
return jQuery.ajax({
url: '/data/energy_data/' + params.house_id + ".json",
dataType: 'json'
@@ -13,6 +31,7 @@ class EnergyDataApi {
});
});
});
}
}