<commit_before>/**
 * Copyright (c) 2014 TopCoder, Inc. All rights reserved.
 */
'use strict';

angular.module('mean.challenges').controller('ListChallengesController', ['$scope', '$stateParams', '$location', '$sce', 'Global', 'Challenges',
    function($scope, $stateParams, $location, $sce, Global, Challenges) {
        $scope.global = Global;

        $scope.remove = function(challenge) {
            if (challenge) {
                challenge.$remove();

                for (var i in $scope.challenges) {
                    if ($scope.challenges[i] === challenge) {
                        $scope.challenges.splice(i, 1);
                    }
                }
            }
        };

        $scope.filterOptions = {};

        $scope.sortInfo = {
            fields: ['challengeId'],
            directions: ['asc']
        };

        $scope.pagingOptions = {
            pageSizes: [10, 25, 50, 100],
            pageSize: 10,
            currentPage: 1
        };

        $scope.find = function() {
            var
                pageSize = $scope.pagingOptions.pageSize,
                currentPage = $scope.pagingOptions.currentPage,
                query = {
                    take: pageSize,
                    skip: pageSize * (currentPage-1),
                    filter: $scope.filterOptions,
                    sortInfo: $scope.sortInfo
                };
            Challenges.query(query, function(responce) {
                $scope.totalServerItems = responce.totalCount;
                $scope.challenges = responce.data;
            });
        };



        $scope.gridOptions = {
            enableRowSelection:false,
            data: 'challenges',
            columnDefs: [
                {field:'id', displayName:'ID', width: 75, sort: {direction: 'desc', priority: 1} },
                {field:'title', displayName: 'Title', cellTemplate: '<a data-ng-href="#!/challenges/{{row.getProperty(\'id\')}}">{{row.getProperty(col.field)}}</a>' },
                {field:'status', displayName: 'status'},
                {field:'createdAt', displayName:'Created', cellFilter: 'date:\'yyyy-MM-dd HH:mm a Z\'' },
                {field:'id', displayName:'', width:75, cellTemplate: '<a class="btn " href="/#!/challenges/{{row.getProperty(col.field)}}/edit"><i class="glyphicon glyphicon-edit"></i></a>' }
            ],
            plugins: [new window.ngGridFlexibleHeightPlugin()],<commit_msg>added createdBy and type to listview<commit_after>/**
 * Copyright (c) 2014 TopCoder, Inc. All rights reserved.
 */
'use strict';

angular.module('mean.challenges').controller('ListChallengesController', ['$scope', '$stateParams', '$location', '$sce', 'Global', 'Challenges',
    function($scope, $stateParams, $location, $sce, Global, Challenges) {
        $scope.global = Global;

        $scope.remove = function(challenge) {
            if (challenge) {
                challenge.$remove();

                for (var i in $scope.challenges) {
                    if ($scope.challenges[i] === challenge) {
                        $scope.challenges.splice(i, 1);
                    }
                }
            }
        };

        $scope.filterOptions = {};

        $scope.sortInfo = {
            fields: ['challengeId'],
            directions: ['asc']
        };

        $scope.pagingOptions = {
            pageSizes: [10, 25, 50, 100],
            pageSize: 10,
            currentPage: 1
        };

        $scope.find = function() {
            var
                pageSize = $scope.pagingOptions.pageSize,
                currentPage = $scope.pagingOptions.currentPage,
                query = {
                    take: pageSize,
                    skip: pageSize * (currentPage-1),
                    filter: $scope.filterOptions,
                    sortInfo: $scope.sortInfo
                };
            Challenges.query(query, function(responce) {
                $scope.totalServerItems = responce.totalCount;
                $scope.challenges = responce.data;
            });
        };



        $scope.gridOptions = {
            enableRowSelection:false,
            data: 'challenges',
            columnDefs: [
                {field:'id', displayName:'ID', width: 75, sort: {direction: 'desc', priority: 1} },
                {field:'title', displayName: 'Title', cellTemplate: '<a data-ng-href="#!/challenges/{{row.getProperty(\'id\')}}">{{row.getProperty(col.field)}}</a>' },
                {field:'status', displayName: 'status'},
                {field:'createdBy', displayName: 'CreatedBy'},
                {field:'type', displayName: 'type'},
                {field:'createdAt', displayName:'Created', cellFilter: 'date:\'yyyy-MM-dd HH:mm a Z\'' },
                {field:'id', displayName:'', width:75, cellTemplate: '<a class="btn " href="/#!/challenges/{{row.getProperty(col.field)}}/edit"><i class="glyphicon glyphicon-edit"></i></a>' }
            ],
            plugins: [new window.ngGridFlexibleHeightPlugin()],
{'fraction_non_alphanumeric': 0.15347625726307354, 'fraction_numerical': 0.009216589861751152, 'mean_word_length': 1.7919463087248322, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2011295', 'n_tokens_mistral': 1484, 'n_tokens_neox': 1329, 'n_words': 254}