<commit_before>'use strict';
(function (module) {
    var module;
    try {
        module = angular.module('tink.gis');
    } catch (e) {
        module = angular.module('tink.gis', ['tink.accordion', 'tink.tinkApi', 'ui.sortable', 'tink.modal', 'angular.filter']); //'leaflet-directive'
    }
    var theController = module.controller('searchAdvancedController', ['$scope', '$modalInstance', 'SearchAdvancedService', 'MapData', 'GISService', 'UIService', 'ResultsData',
        function ($scope, $modalInstance, SearchAdvancedService, MapData, GISService, UIService, ResultsData) {
            $scope.editor = false;
            $scope.selectedLayer = null;
            $scope.operations = [];
            if ($scope.query == undefined) $scope.query = null;

            $scope.openQueryEditor = function () {
                $scope.editor = true;
                if ($scope.selectedLayer) {
                    SearchAdvancedService.BuildQuery($scope.selectedLayer.name);
                }
            };

            $scope.SelectedLayers = function () {
                //display only usable layers
                var layers = MapData.VisibleLayers.filter(data => data.name !== "Alle lagen");
                if (layers.length == 1){
                    $scope.selectedLayer = layers[0];
                    SearchAdvancedService.UpdateFields($scope.selectedLayer);
                }
                return layers;
            }

            $scope.updateFields = function() {
                if ($scope.selectedLayer != null && $scope.selectedLayer != undefined){
                    SearchAdvancedService.UpdateFields($scope.selectedLayer);
                }
            }

            $scope.$on('queryBuild', function (event, data) {
                $scope.query = data;
            })

            $scope.$on('queryOperationUpdated', function (event, data) {
                $scope.query = data;
                $scope.editor = false;
            })

            $scope.$on('deleteOperation', function () {
                $scope.editor = false;
            })

            $scope.addOperation = function () {
                $scope.editor = false;
                SearchAdvancedService.newAddOperation();
            };

            $scope.orOperation = function () {
                $scope.editor = false;
                SearchAdvancedService.newOrOperation();
            };

            $scope.ok = function () {
                $modalInstance.$close();
            };
            $scope.cancel = function () {
                $modalInstance.$dismiss('cancel is pressed');
            };

            $scope.QueryAPI = function () {
                if (!$scope.editor) {
                    SearchAdvancedService.BuildQuery($scope.selectedLayer);
                    var query = SearchAdvancedService.TranslateOperations($scope.operations);
                    var result = SearchAdvancedService.ExecuteQuery($scope.selectedLayer, query);
                } else {
                    var rawQueryResult = SearchAdvancedService.MakeNewRawQuery($scope.query);
                    if (rawQueryResult.layer != null) {
                        var result = SearchAdvancedService.ExecuteQuery(rawQueryResult.layer, rawQueryResult.query);
                    }
                }
                
                UIService.OpenLeftSide();
                $modalInstance.$close();
            };

            if ($scope.query != null && $scope.query != ""){
                $scope.openQueryEditor();
            }
        }]);

    theController.$inject = ['$scope', '$modalInstance', 'SearchAdvancedService', 'MapData', 'UIService', 'GISService', 'ResultsData'];
})();<commit_msg>Logging toegevoegd<commit_after>'use strict';
(function (module) {
    var module;
    try {
        module = angular.module('tink.gis');
    } catch (e) {
        module = angular.module('tink.gis', ['tink.accordion', 'tink.tinkApi', 'ui.sortable', 'tink.modal', 'angular.filter']); //'leaflet-directive'
    }
    var theController = module.controller('searchAdvancedController', ['$scope', '$modalInstance', 'SearchAdvancedService', 'MapData', 'GISService', 'UIService', 'ResultsData',
        function ($scope, $modalInstance, SearchAdvancedService, MapData, GISService, UIService, ResultsData) {
            $scope.editor = false;
            $scope.selectedLayer = null;
            $scope.operations = [];
            if ($scope.query == undefined) $scope.query = null;

            $scope.openQueryEditor = function () {
                $scope.editor = true;
                if ($scope.selectedLayer) {
                    SearchAdvancedService.BuildQuery($scope.selectedLayer.name);
                }
            };

            $scope.SelectedLayers = function () {
                //display only usable layers
                var layers = MapData.VisibleLayers.filter(data => data.name !== "Alle lagen");
                if (layers.length == 1){
                    $scope.selectedLayer = layers[0];
                    SearchAdvancedService.UpdateFields($scope.selectedLayer);
                }
                return layers;
            }

            $scope.updateFields = function() {
                if ($scope.selectedLayer != null && $scope.selectedLayer != undefined){
                    SearchAdvancedService.UpdateFields($scope.selectedLayer);
                }
            }

            $scope.$on('queryBuild', function (event, data) {
                $scope.query = data;
            })

            $scope.$on('queryOperationUpdated', function (event, data) {
                $scope.query = data;
                $scope.editor = false;
            })

            $scope.$on('deleteOperation', function () {
                $scope.editor = false;
            })

            $scope.addOperation = function () {
                $scope.editor = false;
                SearchAdvancedService.newAddOperation();
            };

            $scope.orOperation = function () {
                $scope.editor = false;
                SearchAdvancedService.newOrOperation();
            };

            $scope.ok = function () {
                $modalInstance.$close();
            };
            $scope.cancel = function () {
                $modalInstance.$dismiss('cancel is pressed');
            };

            $scope.QueryAPI = function () {
                if (!$scope.editor) {
                    SearchAdvancedService.BuildQuery($scope.selectedLayer);
                    var query = SearchAdvancedService.TranslateOperations($scope.operations);
                    var result = SearchAdvancedService.ExecuteQuery($scope.selectedLayer, query);
                    console.log("editor = false");
                } else {
                    var rawQueryResult = SearchAdvancedService.MakeNewRawQuery($scope.query);
                    if (rawQueryResult.layer != null) {
                        var result = SearchAdvancedService.ExecuteQuery(rawQueryResult.layer, rawQueryResult.query);
                    }
                    console.log("editor = true ");
                }
                
                UIService.OpenLeftSide();
                $modalInstance.$close();
            };

            if ($scope.query != null && $scope.query != ""){
                $scope.openQueryEditor();
            }
        }]);

    theController.$inject = ['$scope', '$modalInstance', 'SearchAdvancedService', 'MapData', 'UIService', 'GISService', 'ResultsData'];
})();
{'fraction_non_alphanumeric': 0.12591899478679322, 'fraction_numerical': 0.0005346878759524128, 'mean_word_length': 1.6560170394036209, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3869573', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1744, 'n_words': 317}