<commit_before>(function () {
    "use strict";

    // Globally (to this module) listen for mouse down so we can check later if the mouse is depressed :
    var _down = false;
    $(document).mousedown(function(e) {
        _down = true;
    }).mouseup(function(e) {
        _down = false;
    }).mouseleave(function(e) {
        _down = false;
    });

    app.DiaryView = BBC.BaseView.extend({

        template : _.template($('#Diary-template').html(), null, {variable : 'data'}),

        render : function () {
            var self = this;

            this.collection.each(function (dayModel) {
                var newView = self.subViews.add(app.DiaryRowView, {
                    model : dayModel
                }).render();

                self.$el.append(newView.$el);
            });

            return this;
        }

    });

    /**
     * Row view represents each day model. For each day you can click on the time slots to indicate your sleep patterns.
     * This view has as it's sub views a collection of DiaryTimeViews (below)
     * @type {void|*}
     */
    app.DiaryRowView = BBC.BaseView.extend({

        className : 'diary-row',

        template : _.template($('#DiaryRow-template').html(), null, {variable : 'data'}),

        _timeout : null,
        _currContainer : null,
        _amPm : 'AM : ',

        initialize : function () {
            this.on('changeSleepState', this.changeSleepState);
        },

        render : function () {
            this.$el.html(this.template(this.model.toJSON()));
            this.renderTimes();
            return this;
        },

        renderTimes : function () {
            //console.log(1, new Date().getSeconds(), new Date().getMilliseconds());
            var morning = this._getTimeRange(true, 9, 11);
            var noon = this._getTimeRange(false, 12, 12);
            var afternoon = this._getTimeRange(false, 1, 8);
            var evening = this._getTimeRange(false, 9, 11);
            var midnight = this._getTimeRange(true, 12, 12);
            var night = this._getTimeRange(true, 1, 8);

            // First add the divider with the "Day" label
            // Next loop over the day values and add each cell :
            // Now add another divider with the "Night" label
            // Finally add each of the night cells :
            //console.log(2, new Date().getSeconds(), new Date().getMilliseconds());
            this._addDivider('Night :');

            this._addTimes(evening);
            this._addTimes(midnight);
            this._addTimes(night);

            this._addDivider('Day : : ');

            this._addTimes(morning);
            this._addTimes(noon);
            this._addTimes(afternoon);
            //console.log(3, new Date().getSeconds(), new Date().getMilliseconds());
        },

        /**
         * Helper function to get keys in a given time range.
         * @param am
         * @param lowerBound
         * @param upperBound
         * @returns {Array}<commit_msg>Changed the order of the times to am / pm<commit_after>(function () {
    "use strict";

    // Globally (to this module) listen for mouse down so we can check later if the mouse is depressed :
    var _down = false;
    $(document).mousedown(function(e) {
        _down = true;
    }).mouseup(function(e) {
        _down = false;
    }).mouseleave(function(e) {
        _down = false;
    });

    app.DiaryView = BBC.BaseView.extend({

        template : _.template($('#Diary-template').html(), null, {variable : 'data'}),

        render : function () {
            var self = this;

            this.collection.each(function (dayModel) {
                var newView = self.subViews.add(app.DiaryRowView, {
                    model : dayModel
                }).render();

                self.$el.append(newView.$el);
            });

            return this;
        }

    });

    /**
     * Row view represents each day model. For each day you can click on the time slots to indicate your sleep patterns.
     * This view has as it's sub views a collection of DiaryTimeViews (below)
     * @type {void|*}
     */
    app.DiaryRowView = BBC.BaseView.extend({

        className : 'diary-row',

        template : _.template($('#DiaryRow-template').html(), null, {variable : 'data'}),

        _timeout : null,
        _currContainer : null,
        _amPm : 'AM : ',

        initialize : function () {
            this.on('changeSleepState', this.changeSleepState);
        },

        render : function () {
            this.$el.html(this.template(this.model.toJSON()));
            this.renderTimes();
            return this;
        },

        renderTimes : function () {
            var am = this._getTimeRange(true, 1, 12);
            var pm = this._getTimeRange(false, 1, 12);

            this._addDivider('PM :');
            this._addTimes(pm);

            this._addDivider('AM :');
            this._addTimes(am);
        },

        /**
         * Helper function to get keys in a given time range.
         * @param am
         * @param lowerBound
         * @param upperBound
         * @returns {Array}
{'fraction_non_alphanumeric': 0.12860483242400625, 'fraction_numerical': 0.005261106780982073, 'mean_word_length': 1.7927094668117518, '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': '95467', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1384, 'n_words': 379}