<commit_before>define(['../module'], function(controllers) {
    'use strict';

    controllers.controller('ListStudentCtrl', ['$scope', '$http', '$log', '$state', 'StudentSvc',
        function($scope, $http, $log, $state, StudentSvc) {
            $scope.filterOptions = {
                filterText: '',
                useExternalFilter: true
            };

            $scope.totalServerItems = 0;
            $scope.pagingOptions = {
                pageSizes: [250, 500, 1000],
                pageSize: 250,
                currentPage: 1
            };

            $scope.setPagingData = function(data, page, pageSize){
                var pagedData = data.slice((page - 1) * pageSize, page * pageSize);
                $scope.myData = pagedData;
                $scope.totalServerItems = data.length;
                if (!$scope.$$phase) {
                    $scope.$apply();
                }
            };

            $scope.getPagedDataAsync = function (pageSize, page, searchText) {
                setTimeout(function () {
                    var data;
                    data = StudentSvc.list();
                    $scope.setPagingData(data,page,pageSize);
/*
                    if (searchText) {
                        var ft = searchText.toLowerCase();
                        $http.get('jsonFiles/largeLoad.json').success(function (largeLoad) {
                            data = largeLoad.filter(function(item) {
                                return JSON.stringify(item).toLowerCase().indexOf(ft) != -1;
                            });

                            $scope.setPagingData(data,page,pageSize);
                        });
                    } else {
                        $http.get('jsonFiles/largeLoad.json').success(function (largeLoad) {
                            $scope.setPagingData(largeLoad,page,pageSize);
                        });
                    }
*/
                }, 100);
            };

            $scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage);
            $scope.$watch('pagingOptions', function (newVal, oldVal) {
                if (newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
                    $scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage, $scope.filterOptions.filterText);
                }
            }, true);

            $scope.$watch('filterOptions', function (newVal, oldVal) {<commit_msg>adding code for ng-grid<commit_after>define(['../module'], function(controllers) {
    'use strict';

    controllers.controller('ListStudentCtrl', ['$scope', '$http', '$log', '$state', 'StudentSvc',
        function($scope, $http, $log, $state, StudentSvc) {
            $scope.filterOptions = {
                filterText: '',
                useExternalFilter: true
            };

            $scope.totalServerItems = 0;
            $scope.pagingOptions = {
                pageSizes: [250, 500, 1000],
                pageSize: 250,
                currentPage: 1
            };

            $scope.setPagingData = function(data, page, pageSize){
                var pagedData = data.slice((page - 1) * pageSize, page * pageSize);
                $scope.myData = pagedData;
                $scope.totalServerItems = data.length;
                if (!$scope.$$phase) {
                    $scope.$apply();
                }
            };

            $scope.getPagedDataAsync = function (pageSize, page, searchText) {
                setTimeout(function () {
                    var data = {};

                    StudentSvc.list().then(function(students){
                        // add students to new array for ng-grid outputting
                        _(students).forEach(function(student){
                            data.push({
                                'Student_name': student.firstName 
                            })
                        });



                        $scope.setPagingData(data,page,pageSize);
                    });
                    
/*
                    if (searchText) {
                        var ft = searchText.toLowerCase();
                        $http.get('jsonFiles/largeLoad.json').success(function (largeLoad) {
                            data = largeLoad.filter(function(item) {
                                return JSON.stringify(item).toLowerCase().indexOf(ft) != -1;
                            });

                            $scope.setPagingData(data,page,pageSize);
                        });
                    } else {
                        $http.get('jsonFiles/largeLoad.json').success(function (largeLoad) {
                            $scope.setPagingData(largeLoad,page,pageSize);
                        });
                    }
*/
                }, 100);
            };

            $scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage);
            $scope.$watch('pagingOptions', function (newVal, oldVal) {
                if (newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
                    $scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage, $scope.filterOptions.filterText);
                }
            }, true);

            $scope.$watch('filterOptions', function (newVal, oldVal) {
{'fraction_non_alphanumeric': 0.12201492537313433, 'fraction_numerical': 0.007462686567164179, 'mean_word_length': 1.3451443569553805, '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': '6633036', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1290, 'n_words': 206}