<commit_before>var app = app || {};

app.KeyboardView = Backbone.View.extend({
    el: $('#keyboard'),

    initialize: function () {
        var self = this;

        $('#keyboard > .key').each(function (note) {
            new app.KeyView({
                el: $('#' + note)[0],
                model: self.model
            });
        });

        this.listenTo(this.model, 'change', this.render);
        this.listenTo(this.model, 'change', this.updateUrl);
    },

    render: function () {
        var notes = this.model.get('notes');

        notes.forEach(function (note) {
            $('#' + note).addClass('selected');
        });

        return this;
    },

    updateUrl: function () {
        var selectedNotes = this.model.get('notes');

        app.Router.navigate('diagram/' + selectedNotes.join());
    }
});

app.KeyView = app.SvgView.extend({
    events: {
        'click': 'toggleSelect'
    },

    toggleSelect: function (event) {
        $(this.$el).toggleClass('selected');

        var notes = $('.selected').map(function (index, note) {
            return note.id;
        }).toArray();

        this.model.set('notes', notes);
    }
});<commit_msg>convert id to int<commit_after>var app = app || {};

app.KeyboardView = Backbone.View.extend({
    el: $('#keyboard'),

    initialize: function () {
        var self = this;

        $('#keyboard > .key').each(function (note) {
            new app.KeyView({
                el: $('#' + note)[0],
                model: self.model
            });
        });

        this.listenTo(this.model, 'change', this.render);
        this.listenTo(this.model, 'change', this.updateUrl);
    },

    render: function () {
        var notes = this.model.get('notes');

        notes.forEach(function (note) {
            $('#' + note).addClass('selected');
        });

        return this;
    },

    updateUrl: function () {
        var selectedNotes = this.model.get('notes');

        app.Router.navigate('diagram/' + selectedNotes.join());
    }
});

app.KeyView = app.SvgView.extend({
    events: {
        'click': 'toggleSelect'
    },

    toggleSelect: function (event) {
        $(this.$el).toggleClass('selected');

        var notes = $('.selected').map(function (index, note) {
            return parseInt(note.id);
        }).toArray();

        this.model.set('notes', notes);
    }
});
{'fraction_non_alphanumeric': 0.18043844856661045, 'fraction_numerical': 0.0008431703204047217, 'mean_word_length': 1.9736842105263157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1059489', 'n_tokens_mistral': 712, 'n_tokens_neox': 686, 'n_words': 129}