<commit_before>//Features to add
//Background css class dependent on weather
//Initial display based on users location
//format city names 


var weatherApp = angular.module('weatherApp', []);


//Main controller.  Controls input and display
weatherApp.controller('WeatherCtrl', ['weatherSrvc', function(weatherSrvc) {
	var self = this;

	self.currentCity = 'Chicago';
	self.currentWeather = 'Sunny';
	self.currentTemp = '70';

	//Calls weatherSrvc and updates weather info
	self.update = function(city) {
		weatherSrvc.getWeather(city).then(function(result) {
			self.currentCity = result.city;
			self.currentWeather = result.main;
			self.currentTemp = result.temp;
		});		
	};

}]);

//Weather Service.
weatherApp.factory('weatherSrvc', ['$http', '$q', function($http, $q) {

	//Calls OpenWeatherMap API and returns object with city, weather, and temperature
	var getWeather = function(city) {
		//replace QUERY with query type - either by city search or more specfic city id
		//city idea would involve bulk download of city id's and then another search function to determine which city for common names
		var OPEN_WEATHER_PATTERN = 'http://api.openweathermap.org/data/2.5/QUERY=';
		var API_KEY = '&APPID=a0d7e44cdb26abb996246b544a26f161';

		// var url = OPEN_WEATHER_PATTERN.replace('QUERY', 'weather?q=' + city + API_KEY);

		var url = 'http://api.openweathermap.org/data/2.5/weather?q=' + city + API_KEY + '&callback=JSON_CALLBACK';

		var defer = $q.defer();


		var weather = {
			city: city,
		};


		$http.jsonp(url).then(function(response) {
			var data = response.data;
			
			if(data) {
				if(data.weather[0]) {
					console.log('yes');
					weather.main = data.weather[0].main;
				}

				if(data.main) {
					weather.temp = data.main.temp;
				}
			} else {
				//missing data
				console.log('no data');
			}

			defer.resolve(weather);
			
		}, function(error) {
			//add error functionality
			console.dir(error);
		});<commit_msg>added more features to todo list<commit_after>//Features to add
//button allowing switch from F to C
//format temp
//Background css class dependent on weather
//day vs night css classes
//Initial display based on users location
//format city names 


var weatherApp = angular.module('weatherApp', []);


//Main controller.  Controls input and display
weatherApp.controller('WeatherCtrl', ['weatherSrvc', function(weatherSrvc) {
	var self = this;

	self.currentCity = 'Chicago';
	self.currentWeather = 'Sunny';
	self.currentTemp = '70';

	//Calls weatherSrvc and updates weather info
	self.update = function(city) {
		weatherSrvc.getWeather(city).then(function(result) {
			self.currentCity = result.city;
			self.currentWeather = result.main;
			self.currentTemp = result.temp;
		});		
	};

}]);

//Weather Service.
weatherApp.factory('weatherSrvc', ['$http', '$q', function($http, $q) {

	//Calls OpenWeatherMap API and returns object with city, weather, and temperature
	var getWeather = function(city) {
		//replace QUERY with query type - either by city search or more specfic city id
		//city idea would involve bulk download of city id's and then another search function to determine which city for common names
		var OPEN_WEATHER_PATTERN = 'http://api.openweathermap.org/data/2.5/QUERY=';
		var API_KEY = '&APPID=a0d7e44cdb26abb996246b544a26f161';

		// var url = OPEN_WEATHER_PATTERN.replace('QUERY', 'weather?q=' + city + API_KEY);

		var url = 'http://api.openweathermap.org/data/2.5/weather?q=' + city + '&units=imperial' + API_KEY + '&callback=JSON_CALLBACK';

		var defer = $q.defer();


		var weather = {
			city: city,
		};


		$http.jsonp(url).then(function(response) {
			var data = response.data;
			console.dir(data);
			
			if(data) {
				if(data.weather[0]) {
					console.log('yes');
					weather.main = data.weather[0].main;
				}

				if(data.main) {
					weather.temp = data.main.temp;
				}
			} else {
				//missing data
				console.log('no data');
			}

			defer.resolve(weather);
			
		}, function(error) {
			//add error functionality
			console.dir(error);
		});
{'fraction_non_alphanumeric': 0.13713862120088954, 'fraction_numerical': 0.013837410427477144, 'mean_word_length': 3.6157354618015964, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3027798', 'n_tokens_mistral': 1566, 'n_tokens_neox': 1305, 'n_words': 337}