<commit_before>angular.module('sislegisapp').controller(
		'GerenciarReuniaoController',
		function($scope, $rootScope, $http, $filter, $routeParams, $location, $modal, $log, $timeout,
				ReuniaoResource, ProposicaoResource, ComentarioResource, PosicionamentoResource,
				ReuniaoProposicaoResource, TagResource, EncaminhamentoProposicaoResource) {
    var self = this;
    $scope.disabled = false;
    $scope.$location = $location;
    
    $scope.reuniao = new ReuniaoResource();
    $scope.reuniaoProposicao = new ReuniaoProposicaoResource();
    
    $scope.detalhamentoProposicao = false;
    
    $scope.loadTags = function(query) {
    	return TagResource.listarTodos().$promise;
    };     
    

    /**
     * Alerts
     */
    $scope.alerts = [];

    $scope.closeAlert = function(index) {
      $scope.alerts.splice(index, 1);
    };
    
    var addAlert = function(alert){
    	$scope.alerts.push(alert);
    	$timeout(function(){
    		$scope.alerts.splice($scope.alerts.indexOf(alert), 1);
    	}, 3000); // maybe '}, 3000, false);' to avoid calling apply
    }
    
    
    $scope.isClean = function() {
        return angular.equals(self.original, $scope.reuniao);
    };

    $scope.save = function() {
        var successCallback = function(){
            addAlert({type: 'success', msg: 'Registro atualizado com sucesso.'});
        	$rootScope.inativeSpinner = false;
        };
        var errorCallback = function() {
        };
        $scope.selectedProposicao.$update(successCallback, errorCallback);
    };

    $scope.remove = function() {
        alert($scope.reuniao.id);
        ReuniaoResource.remove({ReuniaoId:$scope.reuniao.id})
    };
    
    $scope.getProposicao = function(id) {

        var successCallback = function(data){
        	$scope.selectedProposicao = data;
        	$scope.listaEncaminhamentoProposicao = EncaminhamentoProposicaoResource.findByProposicao({ProposicaoId: $scope.selectedProposicao.id});
            $scope.displayError = false;
        };
        var errorCallback = function(error) {
            $scope.displayError=true;
        };
        
    	ProposicaoResource.get({ProposicaoId: id}, successCallback, errorCallback);
    	$scope.posicionamentos = PosicionamentoResource.queryAll();
    	$scope.detalhamentoProposicao = true;
    }
    
    $scope.removerProposicao = function(id){
    	if(confirm("Deseja realmente excluir esse registro?")){
    		var successCallback = function(){
            	$scope.selectedProposicao = null;
            	
            	ReuniaoResource.buscarReuniaoPorData({data : $scope.dataFormatada()},
            	function(sucess){
            		$scope.listaReuniaoProposicoes = sucess;
            		if($scope.listaReuniaoProposicoes.length > 0){
            			$scope.detalhamentoProposicao = true;
            		}else{
            			$scope.detalhamentoProposicao = false;
            		}
            	},function(){
                	$scope.displayError=true;
            	});
            };
            var errorCallback = function() {
            	$scope.displayError=true;
            };
            
        	ProposicaoResource.remove({ProposicaoId: id}, successCallback, errorCallback);
    	}

    }; 
    
    <commit_msg>refactoring ao remover proposicao<commit_after>angular.module('sislegisapp').controller(
		'GerenciarReuniaoController',
		function($scope, $rootScope, $http, $filter, $routeParams, $location, $modal, $log, $timeout,
				ReuniaoResource, ProposicaoResource, ComentarioResource, PosicionamentoResource,
				ReuniaoProposicaoResource, TagResource, EncaminhamentoProposicaoResource) {
	var self = this;
    $scope.disabled = false;
    $scope.$location = $location;
    
    $scope.reuniao = new ReuniaoResource();
    $scope.reuniaoProposicao = new ReuniaoProposicaoResource();
    
    $scope.detalhamentoProposicao = false;
    
    $scope.loadTags = function(query) {
    	return TagResource.listarTodos().$promise;
    };     
    

    /**
     * Alerts
     */
    $scope.alerts = [];

    $scope.closeAlert = function(index) {
      $scope.alerts.splice(index, 1);
    };
    
    var addAlert = function(alert){
    	$scope.alerts.push(alert);
    	$timeout(function(){
    		$scope.alerts.splice($scope.alerts.indexOf(alert), 1);
    	}, 3000); // maybe '}, 3000, false);' to avoid calling apply
    }
    
    
    $scope.isClean = function() {
        return angular.equals(self.original, $scope.reuniao);
    };

    $scope.save = function() {
        var successCallback = function(){
            addAlert({type: 'success', msg: 'Registro atualizado com sucesso.'});
        	$rootScope.inativeSpinner = false;
        };
        var errorCallback = function() {
        };
        $scope.selectedProposicao.$update(successCallback, errorCallback);
    };

    $scope.remove = function() {
        alert($scope.reuniao.id);
        ReuniaoResource.remove({ReuniaoId:$scope.reuniao.id})
    };
    
    $scope.getProposicao = function(id) {

        var successCallback = function(data){
        	$scope.selectedProposicao = data;
        	$scope.listaEncaminhamentoProposicao = EncaminhamentoProposicaoResource.findByProposicao({ProposicaoId: $scope.selectedProposicao.id});
            $scope.displayError = false;
        };
        var errorCallback = function(error) {
            $scope.displayError=true;
        };
        
    	ProposicaoResource.get({ProposicaoId: id}, successCallback, errorCallback);
    	$scope.posicionamentos = PosicionamentoResource.queryAll();
    	$scope.detalhamentoProposicao = true;
    }
    
    $scope.removerProposicao = function(id){
    	if(confirm("Deseja realmente excluir esse registro?")){
    		var successCallback = function(){
            	
            	ReuniaoResource.buscarReuniaoPorData({data : $scope.dataFormatada()},
            	function(sucess){
            		$scope.listaReuniaoProposicoes = sucess;
            		if($scope.selectedProposicao.id == id){
            			$scope.selectedProposicao = null;
            			$scope.detalhamentoProposicao = false;
            		}
            	},function(){
                	$scope.displayError=true;
            	});
            };
            var errorCallback = function() {
            	$scope.displayError=true;
            };
            
        	ProposicaoResource.remove({ProposicaoId: id}, successCallback, errorCallback);
    	}

    }; 
    
    
{'fraction_non_alphanumeric': 0.12133041848844472, 'fraction_numerical': 0.003279200499687695, 'mean_word_length': 2.456556934700486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5397801', 'n_tokens_mistral': 2055, 'n_tokens_neox': 2004, 'n_words': 288}