<commit_before>'use strict';

var $ = require('jquery');
var _ = require('underscore');
var Marionette = require('backbone.marionette');
var template = require('../templates/timetable_flex.hbs');
var Backbone = require('backbone');
var timify = require('../../common/utils/timify');

module.exports = Marionette.LayoutView.extend({
  template: template,
  initialize: function () {
    console.log(this.model);
    var dayAvailability = this.model.get('dayAvailability');
    _.each(dayAvailability, function (day) {
      var range = _.map(_.range(timify.convertTimeToIndex('0800'), 
                                timify.convertTimeToIndex('2400')), function () {
        return {
          width: 1,
          module: ''
        }
      });

      _.each(day.classes, function (cls) {
        var eightAmIndex = timify.convertTimeToIndex('0800');
        var startIndex = timify.convertTimeToIndex(cls.StartTime) - eightAmIndex;
        var endIndex = timify.convertTimeToIndex(cls.EndTime) - eightAmIndex;
        var width = endIndex - startIndex;
        range[startIndex] = {
          width: width,
          label: cls.ModuleCode,
          class: 'nm-flex-occupied'
        };
      });

      var finalRange = [];
      var step;
      for (var i = 0; i < range.length; i += step) {
        step = range[i].width;
        finalRange.push(range[i]);
      }
      day.timetable = finalRange;
    });
  }
});<commit_msg>More lessonifying<commit_after>'use strict';

var $ = require('jquery');
var _ = require('underscore');
var Marionette = require('backbone.marionette');
var template = require('../templates/timetable_flex.hbs');
var Backbone = require('backbone');
var timify = require('../../common/utils/timify');

module.exports = Marionette.LayoutView.extend({
  template: template,
  initialize: function () {
    console.log(this.model);
    var dayAvailability = this.model.get('dayAvailability');
    _.each(dayAvailability, function (day) {
      var range = _.map(_.range(timify.convertTimeToIndex('0800'), 
                                timify.convertTimeToIndex('2400')), function () {
        return {
          width: 1,
          module: ''
        }
      });

      _.each(day.classes, function (lesson) {
        var eightAmIndex = timify.convertTimeToIndex('0800');
        var startIndex = timify.convertTimeToIndex(lesson.StartTime) - eightAmIndex;
        var endIndex = timify.convertTimeToIndex(lesson.EndTime) - eightAmIndex;
        var width = endIndex - startIndex;
        range[startIndex] = {
          width: width,
          label: lesson.ModuleCode,
          class: 'nm-flex-occupied'
        };
      });

      var finalRange = [];
      var step;
      for (var i = 0; i < range.length; i += step) {
        step = range[i].width;
        finalRange.push(range[i]);
      }
      day.timetable = finalRange;
    });
  }
});
{'fraction_non_alphanumeric': 0.14325452016689846, 'fraction_numerical': 0.009735744089012517, 'mean_word_length': 2.491504854368932, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6124330', 'n_tokens_mistral': 882, 'n_tokens_neox': 840, 'n_words': 165}