<commit_before>$(document).ready(function() {
    $(function(){
    Backbone.Model.prototype.idAttribute = "_id";
    var Rooms = Backbone.Collection.extend({
        model: Room,
        url: 'rooms',
        parse: function(response) {
            _.each(response, function(room) {
                room.id = room._id;
            })
            return response;
        },
        colorForEvent: function(event) {
            return this.get(event.get('location_id')).get('color');
        }
    });

    var Room = Backbone.Model.extend({
        defaults: {
            name: null,
            color: null
        }
    });

    var Event = Backbone.Model.extend({
        defaults: {
            dtstart: null,
            start: null,
            dtend: null,
            end: null,
            title: null,
            location_id: null
        },
        url: function() {
            return '/events' + (this.isNew() ? '' : ('/' + this.id));
        },
        initialize: function() {
            _.bindAll(this, 'setColor', 'setDtstart', 'setDtend');
            if(this.get('location_id')) this.setColor();
            if(this.get('start')) this.setDtstart();
            if(this.get('end')) this.setDtend();
            this.bind('change:location_id', this.setColor);
            this.bind('change:start', this.setDtstart);
            this.bind('change:end', this.setDtend);
        },

        // keep sync between location and it's associate color'
        setColor: function() {
            this.set({color: rooms.colorForEvent(this)});
        },
        // keep sync between full calendar date and server side
        setDtstart: function() {
            this.set({dtstart: this.get('start')});
        },
        // keep sync between full calendar date and server side
        setDtend: function() {
            this.set({dtend: this.get('end')});
        },
        toCallendar: function() {
            var format = this.toJSON();
            format.id = this.id;
            var organizer = this.get('organizer')
            format.title = this.get('title') + (organizer ? (' | ' + organizer.email) : '');

            return format;
        }

    });

    var Events = Backbone.Collection.extend({
        model: Event,
        url: '/events',
        parse: function(response) {
            _.each(response, function(event) {
                event.start = event.dtstart;
                event.end = event.dtend;
            });
            return response;
        },
        toCallendar: function() {
            var t = this.map(function(event) {return event.toCallendar()});
            return t;
        }
    });

    var EventsView = Backbone.View.extend({
        initialize: function(){
            _.bindAll(this);

            this.collection.bind('reset', this.addAll);
            this.collection.bind('add', this.addOne);
            this.collection.bind('change', this.change);
            this.collection.bind('destroy', this.destroy);

            this.eventView = new EventView();
        },
        render: function() {
            this.el.fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                buttonText: {
                    prev:     '&nbsp;&#9668;&nbsp;',  // left triangle
                    next:     '&nbsp;&#9658;&nbsp;',  // right triangle
                    prevYear: '&nbsp;&lt;&lt;&nbsp;', // <<
                    nextYear: '&nbsp;&gt;&gt;&nbsp;', // >>
                    today:    'aujourd\'hui',
                    month:    'mois',
                    week:     'semaine',
                    day:      'jour'
                },
                titleFormat: {
                    month: 'MMMM yyyy',
                    week: "d MMMM[ yyyy]{ - d [ MMMM] yyyy}",
                    agendaDay: 'dddd d MMM yyyy'
                },
                columnFormat: {
                    month: 'ddd',
                    week: 'ddd d/M',
                    day: 'dddd d/M'
                },
                monthNames: ['Janvier', 'Fevrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet',
                 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre'],
                monthNamesShort: ['Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Jui', 'Jui',
                 'Aou', 'Sep', 'Oct', 'Nov', 'Dec'],
                dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
                dayNamesShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
                firstDay: 1,
                timeFormat: 'H:mm{ - H:mm}',
                axisFormat: 'H:mm',
                defaultView: 'agendaWeek',
                firstHour: {
                    week: 8,
                    agendaDay: 8},
                allDayDefault: false,
                allDaySlot: false,
                selectable: true,
                selectHelper: true,
                editable: true,
                ignoreTimezone: false,
                select: this.select,
                eventClick: this.eventClick,
                eventDrop: this.eventDropOrResize,
                eventResize: this.eventDropOrResize<commit_msg>Show only the 8-21 slots<commit_after>$(document).ready(function() {
    $(function(){
    Backbone.Model.prototype.idAttribute = "_id";
    var Rooms = Backbone.Collection.extend({
        model: Room,
        url: 'rooms',
        parse: function(response) {
            _.each(response, function(room) {
                room.id = room._id;
            })
            return response;
        },
        colorForEvent: function(event) {
            return this.get(event.get('location_id')).get('color');
        }
    });

    var Room = Backbone.Model.extend({
        defaults: {
            name: null,
            color: null
        }
    });

    var Event = Backbone.Model.extend({
        defaults: {
            dtstart: null,
            start: null,
            dtend: null,
            end: null,
            title: null,
            location_id: null
        },
        url: function() {
            return '/events' + (this.isNew() ? '' : ('/' + this.id));
        },
        initialize: function() {
            _.bindAll(this, 'setColor', 'setDtstart', 'setDtend');
            if(this.get('location_id')) this.setColor();
            if(this.get('start')) this.setDtstart();
            if(this.get('end')) this.setDtend();
            this.bind('change:location_id', this.setColor);
            this.bind('change:start', this.setDtstart);
            this.bind('change:end', this.setDtend);
        },

        // keep sync between location and it's associate color'
        setColor: function() {
            this.set({color: rooms.colorForEvent(this)});
        },
        // keep sync between full calendar date and server side
        setDtstart: function() {
            this.set({dtstart: this.get('start')});
        },
        // keep sync between full calendar date and server side
        setDtend: function() {
            this.set({dtend: this.get('end')});
        },
        toCallendar: function() {
            var format = this.toJSON();
            format.id = this.id;
            var organizer = this.get('organizer')
            format.title = this.get('title') + (organizer ? (' | ' + organizer.email) : '');

            return format;
        }

    });

    var Events = Backbone.Collection.extend({
        model: Event,
        url: '/events',
        parse: function(response) {
            _.each(response, function(event) {
                event.start = event.dtstart;
                event.end = event.dtend;
            });
            return response;
        },
        toCallendar: function() {
            var t = this.map(function(event) {return event.toCallendar()});
            return t;
        }
    });

    var EventsView = Backbone.View.extend({
        initialize: function(){
            _.bindAll(this);

            this.collection.bind('reset', this.addAll);
            this.collection.bind('add', this.addOne);
            this.collection.bind('change', this.change);
            this.collection.bind('destroy', this.destroy);

            this.eventView = new EventView();
        },
        render: function() {
            this.el.fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                buttonText: {
                    prev:     '&nbsp;&#9668;&nbsp;',  // left triangle
                    next:     '&nbsp;&#9658;&nbsp;',  // right triangle
                    prevYear: '&nbsp;&lt;&lt;&nbsp;', // <<
                    nextYear: '&nbsp;&gt;&gt;&nbsp;', // >>
                    today:    'aujourd\'hui',
                    month:    'mois',
                    week:     'semaine',
                    day:      'jour'
                },
                titleFormat: {
                    month: 'MMMM yyyy',
                    week: "d MMMM[ yyyy]{ - d [ MMMM] yyyy}",
                    agendaDay: 'dddd d MMM yyyy'
                },
                columnFormat: {
                    month: 'ddd',
                    week: 'ddd d/M',
                    day: 'dddd d/M'
                },
                monthNames: ['Janvier', 'Fevrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet',
                 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre'],
                monthNamesShort: ['Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Jui', 'Jui',
                 'Aou', 'Sep', 'Oct', 'Nov', 'Dec'],
                dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
                dayNamesShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
                firstDay: 1,
                timeFormat: 'H:mm{ - H:mm}',
                axisFormat: 'H:mm',
                defaultView: 'agendaWeek',
                minTime: 8,
                maxTime: 21,
                allDayDefault: false,
                allDaySlot: false,
                selectable: true,
                selectHelper: true,
                editable: true,
                ignoreTimezone: false,
                select: this.select,
                eventClick: this.eventClick,
                eventDrop: this.eventDropOrResize,
                eventResize: this.eventDropOrResize
{'fraction_non_alphanumeric': 0.14355161567057478, 'fraction_numerical': 0.0024783147459727386, 'mean_word_length': 1.3888888888888888, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4408129', 'n_tokens_mistral': 2999, 'n_tokens_neox': 2873, 'n_words': 604}