diff --git a/src/public/js/burning-service.js b/src/public/js/burning-service.js index b36391f..48301bb 100644 --- a/src/public/js/burning-service.js +++ b/src/public/js/burning-service.js @@ -273,12 +273,12 @@ function BurningDataService($http) { // // TOTAL: 23 // this.totalDataSets = 23; // this.onAllDatasetsLoaded = null; - // this.registerOnAllDatasetsLoaded = function(callback){ - // if ( this.dataSetsLoaded >= this.totalDataSets ){ - // callback(); - // } - // this.onAllDatasetsLoaded = callback; - // } + this.registerOnAllDatasetsLoaded = function(callback){ + if ( this.dataSetsLoaded >= this.totalDataSets ){ + callback(); + } + this.onAllDatasetsLoaded = callback; + } // this.datasetLoaded = function(){ // this.dataSetsLoaded += 1; @@ -290,21 +290,23 @@ function BurningDataService($http) { // } // } + var myself = this; var stocks; $http.get("/stock_objs", {'timeout': 3000}). success(function(data,status,headers,config){ - stocks = data.map(s => s.key); + console.log(data); + stocks = Object.keys(data); for (var i = 0; i < stocks.length; i++) { loadLifepathsForStock(stocks[i]); loadStartingStatPtsForStock(stocks[i]); loadResourcesForStock(stocks[i]); } console.log("Stocks fetched from server: " + stocks) + myself.onAllDatasetsLoaded() }). error(function(data,status,headers,config){ console.log("Error: Getting stocks from server failed: HTTP code " + status + ": " + data); }); - var myself = this; /* Load lifepaths from server */ var loadLifepathsForStock = function(stock){