<commit_before>define('main', function () {
  var config = require('config'),
      render = require('render'),
      app = require('app'),
      SettingsFormView = require('SettingsFormView'),
      settings = require('settings'),
      ProjectCollection = require('ProjectCollection'),
      ProjectListView = require('ProjectListView'),
      projects = new ProjectCollection(),
      fetch = require('fetch');

  update();

  new SettingsFormView({
    el: '#settings-form',
    model: settings
  }).render();

  new ProjectListView({
    el: '#project-list',
    model: projects
  });

  settings.on('change:token', projects.fetch, projects);
  settings.on('change:token', update);
  
  projects.fetch();

  setInterval(update, config.refreshRate);

  window.addEventListener('hashchange', update);

  function update () {
    if (window.location.hash) {
      fetch(window.location.hash.substr(2), handleFetch);
    }
  }

  function handleFetch (issues) {
    // TODO make columns Backbone views
    var tasks = document.getElementById('tasks'),
        el;

    tasks.innerHTML = '';
    for (state in issues) {
      el = render('column', { state: state, issues: issues[state] });
      tasks.appendChild(el);
    }
  }
});<commit_msg>Only update stories and projects when a token is available<commit_after>define('main', function () {
  var config = require('config'),
      render = require('render'),
      app = require('app'),
      SettingsFormView = require('SettingsFormView'),
      settings = require('settings'),
      ProjectCollection = require('ProjectCollection'),
      ProjectListView = require('ProjectListView'),
      projects = new ProjectCollection(),
      fetch = require('fetch');

  updateStories();
  updateProjects();

  new SettingsFormView({
    el: '#settings-form',
    model: settings
  }).render();

  new ProjectListView({
    el: '#project-list',
    model: projects
  });

  settings.on('change:token', updateProjects);
  settings.on('change:token', updateStories);

  setInterval(updateStories, config.refreshRate);

  window.addEventListener('hashchange', updateStories);

  function updateStories () {
    if (window.location.hash && settings.get('token')) {
      fetch(window.location.hash.substr(2), handleFetch);
    }
  }

  function updateProjects () {
    if (settings.get('token')) {
      projects.fetch();
    }
  }

  function handleFetch (issues) {
    // TODO make columns Backbone views
    var tasks = document.getElementById('tasks'),
        el;

    tasks.innerHTML = '';
    for (state in issues) {
      el = render('column', { state: state, issues: issues[state] });
      tasks.appendChild(el);
    }
  }
});
{'fraction_non_alphanumeric': 0.14893617021276595, 'fraction_numerical': 0.0007465472191116088, 'mean_word_length': 3.437086092715232, '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': '2532489', 'n_tokens_mistral': 744, 'n_tokens_neox': 718, 'n_words': 166}