<commit_before>angular.module('billett.admin').factory('AdminPaymentgroup', function ($http, $modal, $resource) {
    var r = $resource('api/paymentgroup/:id', {
        id: '@id'
    }, {
        update: {
            method: 'PUT'
        }
    });

    r.prototype.close = function () {
        return $http.post('api/paymentgroup/' + this.id + '/close');
    };

    r.getValid = function (eventgroup_id) {
        return this.query({filter: 'eventgroup_id='+parseInt(eventgroup_id)+',time_end=0'});
    };

    r.setPreferredGroup = function (group) {
        if (typeof(Storage) !== 'undefined') {
            sessionStorage.lastPaymentgroup = group.id;
        }
    };

    r.getPreferredGroup = function (grouplist, override_id) {
        var group = null;
        var last_id = (typeof(Storage) !== 'undefined' && sessionStorage.lastPaymentgroup ? sessionStorage.lastPaymentgroup : null);

        grouplist.forEach(function (row) {
            if (row.id == override_id) {
                group = row;
            } else if (row.id == last_id && !group) {
                group = row;
            }
        });

        return group;
    };

    r.newModal = function (eventgroupId) {
        return $modal.open({
            templateUrl: 'assets/views/admin/paymentgroup/new.html',
            controller: 'AdminPaymentgroupNewController as ctrl',
            resolve: {
                eventgroupId: function () {
                    return eventgroupId;
                }
            }
        });
    };<commit_msg>Don't bother checking for sessionstorage support<commit_after>angular.module('billett.admin').factory('AdminPaymentgroup', function ($http, $modal, $resource) {
    var r = $resource('api/paymentgroup/:id', {
        id: '@id'
    }, {
        update: {
            method: 'PUT'
        }
    });

    r.prototype.close = function () {
        return $http.post('api/paymentgroup/' + this.id + '/close');
    };

    r.getValid = function (eventgroup_id) {
        return this.query({filter: 'eventgroup_id='+parseInt(eventgroup_id)+',time_end=0'});
    };

    r.setPreferredGroup = function (group) {
        if (group) {
            sessionStorage.lastPaymentgroup = group.id;
        }
    };

    r.getPreferredGroup = function (grouplist, override_id) {
        var group = null;
        var last_id = sessionStorage.lastPaymentgroup ? sessionStorage.lastPaymentgroup : null;

        grouplist.forEach(function (row) {
            if (row.id == override_id) {
                group = row;
            } else if (row.id == last_id && !group) {
                group = row;
            }
        });

        return group;
    };

    r.newModal = function (eventgroupId) {
        return $modal.open({
            templateUrl: 'assets/views/admin/paymentgroup/new.html',
            controller: 'AdminPaymentgroupNewController as ctrl',
            resolve: {
                eventgroupId: function () {
                    return eventgroupId;
                }
            }
        });
    };
{'fraction_non_alphanumeric': 0.13357519788918207, 'fraction_numerical': 0.0006596306068601583, 'mean_word_length': 1.8940839694656488, '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': '673482', 'n_tokens_mistral': 875, 'n_tokens_neox': 841, 'n_words': 160}