<commit_before>angular.module('stocks')
.factory('stocksFtry', function($http, $log){
	var stocks = {};
	
	stocks.data = {};
	
	stocks.userStocks = [];
	
	// get all stocks
	stocks.getAllData = function(){
		
		var allData = {};
		
		$http.post('/FishStock/getAll.do')
			.then(function(response){
				$log.log("Get all -- response object: ");
				$log.log(response.data);
				angular.forEach(response.data.stocks, function(each){
					each.history.reverse();
				});
				angular.copy(response.data, stocks.data);
				angular.copy(response.data, allData);
				
			})
			.catch(function(response){
				$log.log("There was an error, error status: " + response.status);
			});
		return allData;
	};
	
	// grab user stocks
	stocks.getUserStocks = function(){
		$http.get('/FishStock/getWatchList.do')
			.then(function(response){
				$log.log("Get User Stocks -- response object: ");
				$log.log(response.data);
				angular.copy(response.data, stocks.userStocks);
				stocks.getStocksPredictions(stocks.userStocks); //added by Ilya
			})
			.catch(function(response){
				$log.log("There was an error, error status: " + response.status);
			});
		$log.log(stocks.userStocks);
	};
	
	// add stock
	stocks.addStock = function(company, success){
		$http.post('/FishStock/addToWatch.do', company)
			.then(function(response){
				success();
			})
			.catch(function(response){
				$log.log("There was an error, error status: " + response.status);
			});
	};
	
	
	// remove stock
	stocks.removeStock = function(company){
		$http.get('/FishStock/removeFromWatch.do', company)
			.then(function(response){
				$log.log("Remove stock -- response object: ");
				$log.log(response.data);
			})
			.catch(function(response){
				$log.log("There was an error, error status: " + response.status);
			});
	};
	
	//get a stock prediction
	stocks.getStockPrediction = function(company){
		$http.get('/FishStock/getPrediction.do', company)
			.then(function(response) {
				stocks.predictions.push(response.data);
			})
			.catch(function(response){
				$log.log("Error: " + response.status)
			});
	};
	
	//get predictions for many stocks
	stocks.getStocksPredictions = function(companies){
		$http.get('/FishStock/getPredictions.do', companies)
			.then(function(response) {
				angular.copy(response.data, stocks.predictions);
			})
			.catch(function(response){
				$log.log("Error: " + response.status)
			});
	};
	
	return stocks;
});<commit_msg>small fixes<commit_after>angular.module('stocks')
.factory('stocksFtry', function($http, $log){
	var stocks = {};
	
	stocks.data = {};
	
	stocks.userStocks = [];
	
	// get all stocks
	stocks.getAllData = function(){
		
		var allData = {};
		
		$http.post('/FishStock/getAll.do')
			.then(function(response){
				$log.log("Get all -- response object: ");
				$log.log(response.data);
				angular.forEach(response.data.stocks, function(each){
					each.history.reverse();
				});
				angular.copy(response.data, stocks.data);
				angular.copy(response.data, allData);
				
			})
			.catch(function(response){
				$log.log("There was an error, error status: " + response.status);
			});
		return allData;
	};
	
	// grab user stocks
	stocks.getUserStocks = function(){
		$http.get('/FishStock/getWatchList.do')
			.then(function(response){
				$log.log("Get User Stocks -- response object: ");
				$log.log(response.data);
				angular.copy(response.data, stocks.userStocks);
			})
			.catch(function(response){
				$log.log("There was an error, error status: " + response.status);
			});
		$log.log(stocks.userStocks);
	};
	
	// add stock
	stocks.addStock = function(company, success){
		$http.post('/FishStock/addToWatch.do', company)
			.then(function(response){
				success();
			})
			.catch(function(response){
				$log.log("There was an error, error status: " + response.status);
			});
	};
	
	
	// remove stock
	stocks.removeStock = function(company){
		$http.get('/FishStock/removeFromWatch.do', company)
			.then(function(response){
				$log.log("Remove stock -- response object: ");
				$log.log(response.data);
			})
			.catch(function(response){
				$log.log("There was an error, error status: " + response.status);
			});
	};
	
	//get a stock prediction
	stocks.getStockPrediction = function(company){
		$http.get('/FishStock/getPrediction.do', company)
			.then(function(response) {
				stocks.predictions.push(response.data);
			})
			.catch(function(response){
				$log.log("Error: " + response.status)
			});
	};
	
	//get predictions for many stocks
	stocks.getStocksPredictions = function(companies){
		$http.get('/FishStock/getPredictions.do', companies)
			.then(function(response) {
				angular.copy(response.data, stocks.predictions);
			})
			.catch(function(response){
				$log.log("Error: " + response.status)
			});
	};
	
	return stocks;
});
{'fraction_non_alphanumeric': 0.17368640533778149, 'fraction_numerical': 0.0, 'mean_word_length': 3.5426136363636362, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4881080', 'n_tokens_mistral': 1900, 'n_tokens_neox': 1563, 'n_words': 265}