Skip to content

Commit 8aba2c0

Browse files
committed
about to make some changes to take advantage of the deferred api
1 parent 87197c1 commit 8aba2c0

2 files changed

Lines changed: 36 additions & 10 deletions

File tree

learning_web_proj/angularLearning/app/controllers/reportConfigController.js

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,44 @@ var cntrlFunction = function ($scope, $routeParams, $location, runReportFactory,
121121
$scope.showprogress = true;
122122
$scope.progressMessage = 'Getting data... (can take a few minutes)'
123123
$scope.progressbarState = 100;
124-
// TODO: modify this query to run a separate query per product
125-
//$scope.products = productConfig.query({}, function() {
126-
//console.log("products:" + $scope.products );
127-
$scope.reportData = runReportFactory.query(
124+
$scope.products = productConfig.query(function() {
125+
console.log('got the products!');
126+
for (var i=0; i<$scope.products.length; i+=1) {
127+
console.log(" product:" + $scope.products[i]['data']);
128+
//console.log(" keys: " + Object.keys($scope.products[i]));
129+
130+
$scope.chartObject = runReportFactory.query(
128131
{'startDate': utcStart,
129132
'endDate': utcEnd,
130-
'reportResolution': reportResolution}, function() {
133+
'reportResolution': reportResolution,
134+
'product': $scope.products[i]['data']}, function() {
131135
var i, j, row, chartData;
132-
chartData = restructData($scope.reportData);
133-
$scope.chartObject = chartData;
136+
//chartData = restructData($scope.reportData);
137+
//$scope.chartObject = $scope.reportData;
134138
console.log('chartObject');
135-
console.log(JSON.stringify(chartData));
139+
console.log(JSON.stringify($scope.chartObject));
136140
$scope.showprogress = false;
137141
});
138-
//)
142+
}
143+
144+
145+
});
146+
// TODO: modify this query to run a separate query per product
147+
// $scope.products = productConfig.query( function() {
148+
// console.log("products:" + $scope.products );
149+
// $scope.reportData = runReportFactory.query(
150+
// {'startDate': utcStart,
151+
// 'endDate': utcEnd,
152+
// 'reportResolution': reportResolution}, function() {
153+
// var i, j, row, chartData;
154+
// console.log("report data: " + $scope.reportData);
155+
// //chartData = restructData($scope.reportData);
156+
// $scope.chartObject = $scope.reportData;
157+
// console.log('chartObject');
158+
// console.log(JSON.stringify(chartData));
159+
// $scope.showprogress = false;
160+
// });
161+
// ) ;
139162
};
140163

141164
function restructData(inData) {

learning_web_proj/angularLearning/app/factories/esriStatsFactory.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ esriStatsServices.factory('runReportFactory', ['$resource',
6161
baseUrl + 'report/:st/:ed/:res',
6262
{st:'@startDate',
6363
ed: '@endDate',
64-
res: '@reportResolution'}
64+
res: '@reportResolution'},
65+
{
66+
query: {method: 'GET', params: {}, isArray: false}
67+
}
6568
);
6669
}]);
6770

0 commit comments

Comments
 (0)