<commit_before>define(['require', 'app', 'backbone.marionette', 'localforage'],
  function (require, App, Marionette, localforage) {
    'use strict';

    var navigationItem = App.request('addNavigationItem', {
      name: 'Timetable',
      icon: 'table',
      url: '/timetable'
    });

    var timetableView;

    return Marionette.Controller.extend({
      showTimetable: function (academicYear, semester, options) {
        require(['../views/TimetableView'],
          function (TimetableView) {
            navigationItem.select();
            timetableView = new TimetableView();
            App.mainRegion.show(timetableView);
            if (options) {
              options = JSON.parse(decodeURIComponent(options));
              timetableView.setOptions(options);
            } else {
              localforage.getItem('timetableOptions',
                function (options) {
                  timetableView.setOptions(options);
                });
            }
          });
      }
    });
  });<commit_msg>Redirect to current semester's timetable by default<commit_after>define(['require', 'app', 'backbone', 'backbone.marionette', 'localforage', 'json!config.json'],
  function (require, App, Backbone, Marionette, localforage, config) {
    'use strict';

    var navigationItem = App.request('addNavigationItem', {
      name: 'Timetable',
      icon: 'table',
      url: '/timetable'
    });

    var semTimetableFragment = 'timetable/' + config.academicYear.replace('/', '-') + '/sem' + config.semester;
    var timetableView;

    return Marionette.Controller.extend({
      showTimetable: function (academicYear, semester, options) {
        require(['../views/TimetableView'],
          function (TimetableView) {
            if (!semester) {
              return Backbone.history.navigate(semTimetableFragment, {trigger: true});
            }
            navigationItem.select();
            timetableView = new TimetableView();
            App.mainRegion.show(timetableView);
            if (options) {
              options = JSON.parse(decodeURIComponent(options));
              timetableView.setOptions(options);
            } else {
              localforage.getItem('timetableOptions',
                function (options) {
                  timetableView.setOptions(options);
                });
            }
          });
      }
    });
  });
{'fraction_non_alphanumeric': 0.12857142857142856, 'fraction_numerical': 0.0, 'mean_word_length': 2.1831550802139037, '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': '5997137', 'n_tokens_mistral': 666, 'n_tokens_neox': 621, 'n_words': 116}