<commit_before>(function() {
	var app = angular.module("hys1", [ 'ngCookies' ]);

	app.config([ '$sceDelegateProvider', function($sceDelegateProvider) {
		$sceDelegateProvider.resourceUrlWhitelist([ 'self', '/**' ])
	} ]);

	app
			.controller(
					'eventController',
					[
							'$scope',
							'$http',
							function($scope, $http) {
								$scope.loading = true;
								$scope.events = [];
								$scope.showEvents = {
									programmed : true,
									completed : false,
									cancelled : false
								};
								$scope.DEFAULT_PAGE = 1;
								$scope.DEFAULT_CATEGORY_ID = 0;
								$scope.DEFAULT_CATEGORY_NAME = 'All';
								$scope.pagination = [];

								$scope.getEventData = function(categoryId, categoryName, page) {
									$scope.categoryName = typeof categoryName !== 'undefined' ? categoryName
											: 'All';
									page = typeof page !== 'undefined' ? page
											: 1;
									categoryId = typeof categoryId !== 'undefined' ? categoryId
											: 0;
									$scope.idCategorySelected = categoryId;
									$scope.categorySelected = categoryName;
									
									var urlEvents = 'rest/event/' + categoryId + '?1=1';
									if ($scope.latitude && $scope.longitude) {
										urlEvents += '&latitude=' + $scope.latitude
												+ '&longitude=' + $scope.longitude;
									}
									
									if($scope.showEvents.programmed) {
										urlEvents += '&filters=programmed';
									}
									if($scope.showEvents.completed) {
										urlEvents += '&filters=completed';
									}
									if($scope.showEvents.cancelled) {
										urlEvents += '&filters=cancelled';
									}					
									urlEvents += '&page=' + page;
									if ($scope.text) {
										urlEvents += '&text=' + $scope.text;
									}
									
									//alert(urlEvents);
									
									$scope.loading = true;
									$http.get(urlEvents).success(
											function(data) {
												$scope.pagination = data[0];
												$scope.range = buildRange(new Array(),  Math.ceil($scope.pagination.numElemTotal / $scope.pagination.numElemPag));
												$scope.events = data[1];
												$scope.loading = false;
											}).error(function() {
										alert("Event listing ERROR");
										$scope.loading = false;
									});
								};
								
								$scope.search = function() {
									$scope.text = $('#search').val();
									$scope.getEventData($scope.idCategorySelected, $scope.categorySelected, $scope.DEFAULT_PAGE);
								}
								
								$scope.paging = function(pag) {
									$scope.getEventData($scope.idCategorySelected, $scope.categorySelected, pag);
								}

								function geolocFail(categoryId, categoryName) {
									$scope.getEventData($scope.DEFAULT_CATEGORY_ID, $scope.DEFAULT_CATEGORY_NAME, $scope.DEFAULT_PAGE);
								}

								if (navigator.geolocation) {
									navigator.geolocation
											.getCurrentPosition(
													function(position) {
														$scope.latitude = position.coords.latitude;
														$scope.longitude = position.coords.longitude;

														$scope.getEventData($scope.DEFAULT_CATEGORY_ID, $scope.DEFAULT_CATEGORY_NAME, $scope.DEFAULT_PAGE);
													},
													function(error) {
														geolocFail();
													});
								} else {
									geolocFail();
								}

								$scope.getCategoryData = function() {
									$http.get('rest/category').success(
											function(data) {
												$scope.categories = data;<commit_msg>Subidos cambios en la localizacion<commit_after>(function() {
	var app = angular.module("hys1", [ 'ngCookies' ]);

	app.config([ '$sceDelegateProvider', function($sceDelegateProvider) {
		$sceDelegateProvider.resourceUrlWhitelist([ 'self', '/**' ])
	} ]);

	app
			.controller(
					'eventController',
					[
							'$scope',
							'$http',
							function($scope, $http) {
								$scope.loading = true;
								$scope.events = [];
								$scope.showEvents = {
									programmed : true,
									completed : false,
									cancelled : false
								};
								$scope.DEFAULT_PAGE = 1;
								$scope.DEFAULT_CATEGORY_ID = 0;
								$scope.DEFAULT_CATEGORY_NAME = 'All';
								$scope.pagination = [];

								$scope.getEventData = function(categoryId, categoryName, page) {
									$scope.categoryName = typeof categoryName !== 'undefined' ? categoryName
											: 'All';
									page = typeof page !== 'undefined' ? page
											: 1;
									categoryId = typeof categoryId !== 'undefined' ? categoryId
											: 0;
									$scope.idCategorySelected = categoryId;
									$scope.categorySelected = categoryName;
									
									var urlEvents = 'rest/event/' + categoryId + '?1=1';
									if ($scope.latitude && $scope.longitude) {
										urlEvents += '&latitude=' + $scope.latitude
												+ '&longitude=' + $scope.longitude;
									}
									
									if($scope.showEvents.programmed) {
										urlEvents += '&filters=programmed';
									}
									if($scope.showEvents.completed) {
										urlEvents += '&filters=completed';
									}
									if($scope.showEvents.cancelled) {
										urlEvents += '&filters=cancelled';
									}					
									urlEvents += '&page=' + page;
									if ($scope.text) {
										urlEvents += '&text=' + $scope.text;
									}
									
									//alert(urlEvents);
									
									$scope.loading = true;
									$http.get(urlEvents).success(
											function(data) {
												$scope.pagination = data[0];
												$scope.range = buildRange(new Array(),  Math.ceil($scope.pagination.numElemTotal / $scope.pagination.numElemPag));
												$scope.events = data[1];
												$scope.loading = false;
											}).error(function() {
										alert("Event listing ERROR");
										$scope.loading = false;
									});
								};
								
								$scope.search = function() {
									$scope.text = $('#search').val();
									$scope.getEventData($scope.idCategorySelected, $scope.categorySelected, $scope.DEFAULT_PAGE);
								}
								
								$scope.paging = function(pag) {
									$scope.getEventData($scope.idCategorySelected, $scope.categorySelected, pag);
								}

								function geolocFail(categoryId, categoryName) {
									$scope.getEventData($scope.DEFAULT_CATEGORY_ID, $scope.DEFAULT_CATEGORY_NAME, $scope.DEFAULT_PAGE);
									alert("NO SABEMOS POSICION");
								}

								
								//setInterval(checkLocation, 3000);
								
								$scope.navigator_geolocation = navigator.geolocation;
								$scope.$watch("navigator_geolocation", function checkLocation(newValue, oldValue) {
									alert("new: " + newValue + ",old: " + oldValue);
									
									if (newValue) {
										$scope.navigator_geolocation
												.getCurrentPosition(
														function(position) {
															$scope.latitude = position.coords.latitude;
															$scope.longitude = position.coords.longitude;
	
															$scope.getEventData($scope.DEFAULT_CATEGORY_ID, $scope.DEFAULT_CATEGORY_NAME, $scope.DEFAULT_PAGE);
														
															alert("posicion correcta");
														},
														function(error) {
															geolocFail();
														});
									} else {
										geolocFail();
									}
								});

								$scope.getCategoryData = function() {
									$http.get('rest/category').success(
											function(data) {
												$scope.categories = data;
{'fraction_non_alphanumeric': 0.1354882154882155, 'fraction_numerical': 0.002962962962962963, 'mean_word_length': 1.8861251457442674, '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': '7129604', 'n_tokens_mistral': 3778, 'n_tokens_neox': 2141, 'n_words': 324}