<commit_before>angular.module('retro-board')
    .controller('BoardController', function ($scope, cardService) {

    	$scope.card  		 = new cardService();
    	$scope.negativeCards = [];
		$scope.positiveCards = [];
        $scope.card.type = "Positive";
    	
    	positiveCards();
		negativeCards();
        
        function positiveCards() {
        	cardService.query({params: "Positive"}, 

        		function(cards) {
        			$scope.positiveCards = cards;

        		}, function(error) {
        			console.log(error);
        		}

        	); 
        };

         function negativeCards() {
        	cardService.query({params: "Negative"}, 

        		function(cards) {
        			$scope.negativeCards = cards;
                    console.log(cards);

        		}, function(error) {
        			console.log(error);
        		}

        	);
        };

        $scope.newCard = function() {
            var cardsList = $scope.card.comment.split("|"),
                type = $scope.card.type;

            try{
                cardsList.map(function(_comment){
                    $scope.card.comment = _comment;
                    $scope.card.$save();
                    $scope.card = new cardService();
                    $scope.card.type = type;
                });
                positiveCards();
                negativeCards();  
            }catch(error){
                console.log(error);
            }
        };

        $scope.deleteCard = function(card){
            var continuar = confirm("Tem certeza que deseja deletar o card?");
            if(continuar){
                card.$remove({params : card._id}).then(
                    function() {
                        positiveCards();
                        negativeCards();
                    },
                        function(error){
                        console.log(error)
                    }
                )  
            }
            
        }
    });<commit_msg>Tratamento do erro 404 no controller do board<commit_after>angular.module('retro-board')
    .controller('BoardController', function ($scope, cardService) {

    	$scope.card  		 = new cardService();
    	$scope.negativeCards = [];
		$scope.positiveCards = [];
        $scope.card.type = "Positive";
    	
    	positiveCards();
		negativeCards();
        
        function positiveCards() {
            cardService.query({params: "Positive"}, 
                function(cards) {
                    $scope.positiveCards = cards;
                }, function(error) {
                    if(error.status == 404)
                        $scope.positiveCards = [];
        			console.log(error);
        		}

        	); 
        };

        function negativeCards() {
            cardService.query({params: "Negative"},
                function(cards) {
                    $scope.negativeCards = cards;
                }, function(error) {
                    if(error.status == 404)
                        $scope.negativeCards = [];
        			console.log(error);
        		}

        	);
        };

        $scope.newCard = function() {
            var cardsList = $scope.card.comment.split("|"),
                type = $scope.card.type;

            try{
                cardsList.map(function(_comment){
                    $scope.card.comment = _comment;
                    $scope.card.$save();
                    $scope.card = new cardService();
                    $scope.card.type = type;
                });
                positiveCards();
                negativeCards();  
            }catch(error){
                console.log(error);
            }
        };

        $scope.deleteCard = function(card){
            var continuar = confirm("Tem certeza que deseja deletar o card?");
            if(continuar){
                card.$remove({params : card._id}).then(
                    function() {
                        positiveCards();
                        negativeCards();
                    },
                        function(error){
                        console.log(error)
                    }
                )  
            }
            
        }
    });
{'fraction_non_alphanumeric': 0.11940298507462686, 'fraction_numerical': 0.0021665864227250844, 'mean_word_length': 1.1329568788501028, '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': '2882019', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1022, 'n_words': 158}