<commit_before>'use strict';

(function () {
    class AdminCtrl {
        /*@ngInject*/
        constructor(Auth, User, companyService, $modal, sportService) {
            this.Auth = Auth;
            this.User = User;
            this.companyService = companyService;
            this.$modal = $modal;
            this.sportService = sportService;

            this.users = [];
            this.company = {};
            this.sports = [];

            this.getUsers();
            this.getCompany();
            this.getSports();
        }

        getUsers() {
            return this.User.query().$promise.then(data => {
                this.users = data;
                return this.users;
            });
        }

        getCompany() {
            return this.companyService.getCompany(this.Auth.getCurrentUser().company)
                .then(data => {
                    this.company = data;
                    return this.company;
                }, () => {
                });
        }

        getSports() {
            var year = new Date().getFullYear();
            return this.sportService.getSports(year)
                .then(data => {
                    this.sports = data;
                    return this.sports;
                });
        }

        editCompanyInfo(company) {
            var modalInstance = this.$modal.open({
                animation: true,
                templateUrl: 'app/create-company/create-company-modal.html',
                controller: 'EditCompanyCtrl',
                controllerAs: 'createCompany',
                size: 'lg',
                resolve: {
                    company: function () {
                        return company;
                    }
                }
            });

            modalInstance.result.then(() => {
                this.getCompany();
            }, () => {
            });
        }

        setupSports() {
            this.sportService.setupSports()
                .then(data => {
                    this.sports = data.sports;
                    return this.sports;
                });
        }

        enableSport(sport) {
            sport.enabled = true;
            this.sportService.updateSport(sport)
                .then(() => {
                    this.getSports();
                });
        }

        disableSport(sport) {
            sport.enabled = false;<commit_msg>Fixed company object binding<commit_after>'use strict';

(function () {
    class AdminCtrl {
        /*@ngInject*/
        constructor(Auth, User, companyService, $modal, sportService) {
            this.Auth = Auth;
            this.User = User;
            this.companyService = companyService;
            this.$modal = $modal;
            this.sportService = sportService;

            this.users = [];
            this.company = {};
            this.sports = [];

            this.getUsers();
            this.getCompany();
            this.getSports();
        }

        getUsers() {
            return this.User.query().$promise.then(data => {
                this.users = data;
                return this.users;
            });
        }

        getCompany() {
            return this.companyService.getCompany(this.Auth.getCurrentUser().company)
                .then(data => {
                    this.company = data;
                    return this.company;
                }, () => {
                });
        }

        getSports() {
            var year = new Date().getFullYear();
            return this.sportService.getSports(year)
                .then(data => {
                    this.sports = data;
                    return this.sports;
                });
        }

        editCompanyInfo(company) {
            //Use this to avoid changing the original object
            var copyCompany = angular.copy(company);
            var modalInstance = this.$modal.open({
                animation: true,
                templateUrl: 'app/create-company/create-company-modal.html',
                controller: 'EditCompanyCtrl',
                controllerAs: 'createCompany',
                size: 'lg',
                resolve: {
                    company: function () {
                        return copyCompany;
                    }
                }
            });

            modalInstance.result.then(() => {
                this.getCompany();
            }, () => {
            });
        }

        setupSports() {
            this.sportService.setupSports()
                .then(data => {
                    this.sports = data.sports;
                    return this.sports;
                });
        }

        enableSport(sport) {
            sport.enabled = true;
            this.sportService.updateSport(sport)
                .then(() => {
                    this.getSports();
                });
        }

        disableSport(sport) {
            sport.enabled = false;
{'fraction_non_alphanumeric': 0.11287370347773032, 'fraction_numerical': 0.0, 'mean_word_length': 1.0707368421052632, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '653554', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1146, 'n_words': 195}