<commit_before>var app = angular.module("userService", []);


// User service
app.factory('$userService', function($http, $log, config, $authenticationService) {

    var users;
    var cached_filter = {
        offset: 0,
        limit: 50,
        blocked: false,
        orderby: "name.asc"
    };
    var full_count = 0;

    return {
        init: function(){
            return {
                email_address: "",
                title: null,
                first_name: "",
                last_name: "",
                institute_id: null,
                blocked: false
            };
        },
        copy: function(user){
            return {
                user_id: user.user_id,
                email_address: user.email_address,
                title: user.title,
                first_name: user.first_name,
                last_name: user.last_name,
                institute_id: user.institute_id,
                blocked: user.blocked
            };
        },
        get: function(){
            return users;
        },
        getCachedFilter: function(){
            return cached_filter;
        },
        getCount: function(){
            return full_count;
        },
        set: function(data){
            users = data;
        },
        setCachedFilter: function(data) {
            cached_filter = data;
        },
        setCount: function(data) {
            full_count = data;
        },
        list: function(filter) {
            var query = "?orderby=" + filter.orderby + "&";

            if(filter.offset && filter.offset !== null){
                query = query + "offset=" + filter.offset + "&";
            }
            if(filter.offset && filter.limit !== null){
                query = query + "limit=" + filter.limit + "&";
            }
            if(filter.blocked !== null){
                query = query + "blocked=" + filter.blocked + "&";
            }

            query = query.slice(0, -1);

            return $http.get(config.apiURL + "/users" + query, {
                headers: {
                    'Authorization': 'Bearer ' + $authenticationService.getToken()
                }
            });
        },
        listByUniversity: function(university_id, filter) {
            var query = "?orderby=" + filter.orderby + "&";

            if(filter.offset && filter.offset !== null){
                query = query + "offset=" + filter.offset + "&";
            }
            if(filter.limit && filter.limit !== null){
                query = query + "limit=" + filter.limit + "&";
            }
            if(filter.blocked && filter.blocked !== null){
                query = query + "blocked=" + filter.blocked + "&";
            }

            query = query.slice(0, -1);

            return $http.get(config.apiURL + "/universities/" + university_id + "/users" + query, {
                headers: {
                    'Authorization': 'Bearer ' + $authenticationService.getToken()
                }
            });
        },
        listByInstitute: function(institute_id, filter) {

            var query = "?orderby=" + filter.orderby + "&";

            if(filter.offset && filter.offset !== null){
                query = query + "offset=" + filter.offset + "&";
            }
            if(filter.limit && filter.limit !== null){
                query = query + "limit=" + filter.limit + "&";
            }
            if(filter.blocked){
                query = query + "blocked=" + filter.blocked + "&";
            }

            query = query.slice(0, -1);

            return $http.get(config.apiURL + "/institutes/" + institute_id + "/users" + query, {
                headers: {
                    'Authorization': 'Bearer ' + $authenticationService.getToken()
                }
            });
        },<commit_msg>Typo-fixes<commit_after>var app = angular.module("userService", []);


// User service
app.factory('$userService', function($http, $log, config, $authenticationService) {

    var users;
    var cached_filter = {
        offset: 0,
        limit: 50,
        blocked: false,
        orderby: "name.asc"
    };
    var full_count = 0;

    return {
        init: function(){
            return {
                email_address: "",
                title: null,
                first_name: "",
                last_name: "",
                institute_id: null,
                blocked: false
            };
        },
        copy: function(user){
            return {
                user_id: user.user_id,
                email_address: user.email_address,
                title: user.title,
                first_name: user.first_name,
                last_name: user.last_name,
                institute_id: user.institute_id,
                blocked: user.blocked
            };
        },
        get: function(){
            return users;
        },
        getCachedFilter: function(){
            return cached_filter;
        },
        getCount: function(){
            return full_count;
        },
        set: function(data){
            users = data;
        },
        setCachedFilter: function(data) {
            cached_filter = data;
        },
        setCount: function(data) {
            full_count = data;
        },
        list: function(filter) {
            var query = "?orderby=" + filter.orderby + "&";

            if(filter.offset && filter.offset !== null){
                query = query + "offset=" + filter.offset + "&";
            }
            if(filter.limit && filter.limit !== null){
                query = query + "limit=" + filter.limit + "&";
            }
            if(filter.blocked !== null){
                query = query + "blocked=" + filter.blocked + "&";
            }

            query = query.slice(0, -1);

            return $http.get(config.apiURL + "/users" + query, {
                headers: {
                    'Authorization': 'Bearer ' + $authenticationService.getToken()
                }
            });
        },
        listByUniversity: function(university_id, filter) {
            var query = "?orderby=" + filter.orderby + "&";

            if(filter.offset && filter.offset !== null){
                query = query + "offset=" + filter.offset + "&";
            }
            if(filter.limit && filter.limit !== null){
                query = query + "limit=" + filter.limit + "&";
            }
            if(filter.blocked !== null){
                query = query + "blocked=" + filter.blocked + "&";
            }

            query = query.slice(0, -1);

            return $http.get(config.apiURL + "/universities/" + university_id + "/users" + query, {
                headers: {
                    'Authorization': 'Bearer ' + $authenticationService.getToken()
                }
            });
        },
        listByInstitute: function(institute_id, filter) {

            var query = "?orderby=" + filter.orderby + "&";

            if(filter.offset && filter.offset !== null){
                query = query + "offset=" + filter.offset + "&";
            }
            if(filter.limit && filter.limit !== null){
                query = query + "limit=" + filter.limit + "&";
            }
            if(filter.blocked !== null){
                query = query + "blocked=" + filter.blocked + "&";
            }

            query = query.slice(0, -1);

            return $http.get(config.apiURL + "/institutes/" + institute_id + "/users" + query, {
                headers: {
                    'Authorization': 'Bearer ' + $authenticationService.getToken()
                }
            });
        },
{'fraction_non_alphanumeric': 0.13586742075496513, 'fraction_numerical': 0.002630540576088386, 'mean_word_length': 1.3260936066075253, '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': '4433381', 'n_tokens_mistral': 2084, 'n_tokens_neox': 1991, 'n_words': 392}