<commit_before>'use strict';

angular.module('jlogApp.controllers')
    .controller('listViewCtrl', [
        '$scope',
        '$state',
        function($scope,
                 $state) {
            console.log('init listViewCtrl ' + $scope.battle_index);
            console.log($scope.battle);

            if(undefined === $scope.battle) {
                $state.go('battle.list');
            }

            $scope.editBattle = function editBattle() {
                $state.go('battle.edit');
            };
            $scope.deleteBattle = function deleteBattle() {
                $scope.battles.splice($scope.battle_index, 1);
                $scope.updateBattles();
                $scope.close();
            };
        }]);<commit_msg>Ask for confirmation before deleting battle.<commit_after>'use strict';

angular.module('jlogApp.controllers')
    .controller('listViewCtrl', [
        '$scope',
        '$state',
        function($scope,
                 $state) {
            console.log('init listViewCtrl ' + $scope.battle_index);
            console.log($scope.battle);

            if(undefined === $scope.battle) {
                $state.go('battle.list');
            }

            $scope.editBattle = function editBattle() {
                $state.go('battle.edit');
            };
            $scope.deleteBattle = function deleteBattle() {
                var confirm = window.confirm('You sure you wanna delete this battle ?');
                if(!confirm) return;
                $scope.battles.splice($scope.battle_index, 1);
                $scope.updateBattles();
                $scope.close();
            };
        }]);
{'fraction_non_alphanumeric': 0.14182257091128544, 'fraction_numerical': 0.0012070006035003018, 'mean_word_length': 1.6192733017377567, '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': '1338458', 'n_tokens_mistral': 454, 'n_tokens_neox': 441, 'n_words': 69}