<commit_before>import * as utils from 'base/utils';
import Model from 'base/model';

/*!
 * HOOK MODEL
 */

var Marker = Model.extend({

  init: function(name, value, parent, binds, persistent) {
    this._super(name, value, parent, binds, persistent);
    this.on('ready', this.checkTimeLimits.bind(this));
  },

  checkTimeLimits: function() {
    
    if(!this._parent.time) return;
    
    var time = this._parent.time;
    
    var tLimits = this.getTimeLimits();

    if(!tLimits) return;
    if(!utils.isDate(tLimits.min) || !utils.isDate(tLimits.max)) 
        return utils.warn("checkTimeLimits(): min-max look wrong: " + tLimits.min + " " + tLimits.max + ". Expecting Date objects. Ensure that time is properly parsed in the data from reader");

    // change start and end (but keep startOrigin and endOrigin for furhter requests)
    var newTime = {}
    if(time.start - tLimits.min != 0) newTime['start'] = d3.max([tLimits.min, time.parseToUnit(time.startOrigin)]);
    if(time.end - tLimits.max != 0) newTime['end'] = d3.min([tLimits.max, time.parseToUnit(time.endOrigin)]);
    // default to current date. Other option: newTime['start'] || newTime['end'] || time.start || time.end;
    if(time.value == null) newTime['value'] = time.parseToUnit(time.format(new Date())); 
    
    time.set(newTime, false, false);
    
    if (newTime.start || newTime.end) {
      utils.forEach(this.getSubhooks(), function(hook) {<commit_msg>Don't check time limits on splash load<commit_after>import * as utils from 'base/utils';
import Model from 'base/model';

/*!
 * HOOK MODEL
 */

var Marker = Model.extend({

  init: function(name, value, parent, binds, persistent) {
    this._super(name, value, parent, binds, persistent);
    this.on('ready', this.checkTimeLimits.bind(this));
  },

  checkTimeLimits: function() {
    
    var time = this._parent.time;
    
    if(!time || time.splash) return;
    
    var tLimits = this.getTimeLimits();

    if(!tLimits) return;
    if(!utils.isDate(tLimits.min) || !utils.isDate(tLimits.max)) 
        return utils.warn("checkTimeLimits(): min-max look wrong: " + tLimits.min + " " + tLimits.max + ". Expecting Date objects. Ensure that time is properly parsed in the data from reader");

    // change start and end (but keep startOrigin and endOrigin for furhter requests)
    var newTime = {}
    if(time.start - tLimits.min != 0) newTime['start'] = d3.max([tLimits.min, time.parseToUnit(time.startOrigin)]);
    if(time.end - tLimits.max != 0) newTime['end'] = d3.min([tLimits.max, time.parseToUnit(time.endOrigin)]);
    // default to current date. Other option: newTime['start'] || newTime['end'] || time.start || time.end;
    if(time.value == null) newTime['value'] = time.parseToUnit(time.format(new Date())); 
    
    time.set(newTime, false, false);
    
    if (newTime.start || newTime.end) {
      utils.forEach(this.getSubhooks(), function(hook) {
{'fraction_non_alphanumeric': 0.15722622725712324, 'fraction_numerical': 0.0027463096464126332, 'mean_word_length': 3.5673981191222572, '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': '4186532', 'n_tokens_mistral': 981, 'n_tokens_neox': 964, 'n_words': 229}