<commit_before>export default class GroupedCollection {
    constructor(options) {
        this.allItems = options.allItems;
        this.groupsSortOptions = options.groupsSortOptions;
        this.groups = {};

        options.groups.forEach(groupName => {
            const group = new options.class();
            this.groups[groupName] = group;
        });

        this.allCollaplibleItems = new options.class();
        this.allItems.listenTo(this.allItems, 'remove', model => {
            model.trigger('destroy', model);
        });

        this.allItems.listenTo(this.allItems, 'add', model => {
            const { kindConst, groupNames } = this.groupsSortOptions;
            if (model.get('kind') === kindConst) {
                this.groups[groupNames.const].add(model);
            } else {
                this.allCollaplibleItems.add(model);
            }
        });

        this.reset();
    }

    getModels(targetName) {
        return ((targetName && this.groups[targetName]) || this.allCollaplibleItems).slice();
    }

    getAllItemsModels() {
        return this.allItems.parentCollection.slice();
    }

    reset() {
        const { kindConst, groupNames } = this.groupsSortOptions;

        const collabpsibleModels = this.allItems.parentCollection.filter(model => model.get('kind') !== kindConst);
        const constModels = this.allItems.parentCollection.filter(model => model.get('kind') === kindConst);

        this.allCollaplibleItems.reset(collabpsibleModels);<commit_msg>Toolbar: fix button on tasks.<commit_after>export default class GroupedCollection {
    constructor(options) {
        this.allItems = options.allItems;
        this.groupsSortOptions = options.groupsSortOptions;
        this.groups = {};

        options.groups.forEach(groupName => {
            const group = new options.class();
            this.groups[groupName] = group;
        });

        this.allCollapsibleItems = new options.class();
        this.allItems.listenTo(this.allItems, 'remove', model => {
            model.trigger('destroy', model);
        });

        this.allItems.listenTo(this.allItems, 'add', model => {
            const { kindConst, groupNames } = this.groupsSortOptions;
            if (model.get('kind') === kindConst) {
                this.groups[groupNames.const].add(model);
            } else {
                this.allCollapsibleItems.add(model);
            }
        });

        this.reset();
    }

    getModels(targetName) {
        return ((targetName && this.groups[targetName]) || this.allCollapsibleItems).slice();
    }

    getAllItemsModels() {
        return this.allItems.slice();
    }

    reset() {
        const { kindConst, groupNames } = this.groupsSortOptions;

        const collapsibleModels = this.allItems.slice().filter(model => model.get('kind') !== kindConst);
        const constModels = this.allItems.slice().filter(model => model.get('kind') === kindConst);

        this.allCollapsibleItems.reset(collapsibleModels);
{'fraction_non_alphanumeric': 0.13228923692102632, 'fraction_numerical': 0.0, 'mean_word_length': 2.415244596131968, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5995198', 'n_tokens_mistral': 831, 'n_tokens_neox': 809, 'n_words': 129}