<commit_before>'use strict';

/**
 * @ngdoc function
 * @name berlinVeganMapApp.controller:MainController
 * @description
 * # MainController
 * Controller of the berlinVeganMapApp
 */
app.controller('MainController', function ($scope, $http, $timeout, LocationCleansingService, LocationLogicService, filterFilter, locationFilter) {
  
    var debugMode = false;
    var allDistricts = "Alle Bezirke";
    var allWeekDays = "Alle Wochentage";
    
    $scope.query = null;
    $scope.locations = null;
    $scope.districts = null;
    $scope.tags = null;
    $scope.geolocation = { show: false, supported: navigator.geolocation ? true : false };
    $scope.orderSelection = "Name";
    
    $http({method: 'GET', url: 'assets/GastroLocations_2016-05-26_formatted.json'})
        .success(function(data, status, headers, config) {
            $scope.locations = data;
            LocationCleansingService.cleanLocations($scope.locations);
            LocationLogicService.enhanceLocations($scope.locations);
            initQuery();
            initMap();
            initDistricts();
            initTags();
            updateMarkers();
            updateOrder();
        })
        .error(function(data, status, headers, config) {
        });

    $scope.updateMarkers = updateMarkers;
    $scope.updateGeolocationMarker = updateGeolocationMarker;
    $scope.updateOrder = updateOrder;
    
    var infoWindow = new google.maps.InfoWindow();
    
    var createMarker = function (location){
        var marker = new google.maps.Marker({
            map: $scope.map,
            position: new google.maps.LatLng(location.latCoord, location.longCoord),
            title: location.name,
            location: location
        });

        google.maps.event.addListener(marker, 'click', function(){
            infoWindow.setContent(getContent(marker.location));
            infoWindow.open($scope.map, marker);
        });

        $scope.markers.push(marker);
    }
    
    function initQuery() {
        $scope.query = { 
            text: "", 
            district: allDistricts, 
            openAtWeekDay: allWeekDays, 
            tags: {}, 
            allDistricts: function() { return this.district === allDistricts; }, 
            allWeekDays: function() { return this.openAtWeekDay === allWeekDays; },
            distance: { enabled: false, position: null, km: 1}
        };
    }
    
    function initMap() {
    
        var mapOptions = {
            zoom: 12,
            center: new google.maps.LatLng(52.5200070,13.4049540),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        $scope.map = new google.maps.Map(document.getElementById('map'), mapOptions);<commit_msg>All tags checked by default<commit_after>'use strict';

/**
 * @ngdoc function
 * @name berlinVeganMapApp.controller:MainController
 * @description
 * # MainController
 * Controller of the berlinVeganMapApp
 */
app.controller('MainController', function ($scope, $http, $timeout, LocationCleansingService, LocationLogicService, filterFilter, locationFilter) {
  
    var debugMode = false;
    var allDistricts = "Alle Bezirke";
    var allWeekDays = "Alle Wochentage";
    
    $scope.query = null;
    $scope.locations = null;
    $scope.districts = null;
    $scope.tags = null;
    $scope.geolocation = { show: false, supported: navigator.geolocation ? true : false };
    $scope.orderSelection = "Name";
    
    $http({method: 'GET', url: 'assets/GastroLocations_2016-05-26_formatted.json'})
        .success(function(data, status, headers, config) {
            $scope.locations = data;
            LocationCleansingService.cleanLocations($scope.locations);
            LocationLogicService.enhanceLocations($scope.locations);
            initQuery();
            initMap();
            initDistricts();
            initTags();
            updateMarkers();
            updateOrder();
        })
        .error(function(data, status, headers, config) {
        });

    $scope.updateMarkers = updateMarkers;
    $scope.updateGeolocationMarker = updateGeolocationMarker;
    $scope.updateOrder = updateOrder;
    
    var infoWindow = new google.maps.InfoWindow();
    
    var createMarker = function (location){
        var marker = new google.maps.Marker({
            map: $scope.map,
            position: new google.maps.LatLng(location.latCoord, location.longCoord),
            title: location.name,
            location: location
        });

        google.maps.event.addListener(marker, 'click', function(){
            infoWindow.setContent(getContent(marker.location));
            infoWindow.open($scope.map, marker);
        });

        $scope.markers.push(marker);
    }
    
    function initQuery() {
    
        var tags = LocationLogicService.getSortedTags($scope.locations);
        var tagsMap = {};
        
        for (var i = 0; i < tags.length; i++) {
            tagsMap[tags[i]] = true;
        }
        
        $scope.query = { 
            text: "", 
            district: allDistricts, 
            openAtWeekDay: allWeekDays, 
            tags: tagsMap, 
            allDistricts: function() { return this.district === allDistricts; }, 
            allWeekDays: function() { return this.openAtWeekDay === allWeekDays; },
            distance: { enabled: false, position: null, km: 1}
        };
    }
    
    function initMap() {
    
        var mapOptions = {
            zoom: 12,
            center: new google.maps.LatLng(52.5200070,13.4049540),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        $scope.map = new google.maps.Map(document.getElementById('map'), mapOptions);
{'fraction_non_alphanumeric': 0.11898016997167139, 'fraction_numerical': 0.010446175637393768, 'mean_word_length': 2.3209876543209877, 'pattern_counts': {'":': 0, '<': 4, '<?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': '6414680', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1573, 'n_words': 312}