<commit_before>class RetroRunner {
  constructor(socket, retroMetadata) {
    this.socket = socket;
    this.retro = retroMetadata;
    this.categoryIndex = 0;
    this.voting = false;
  }

  run() {
    this.categoryIndex = 0;
    this.voting = false;
    this.next();
  }

  next() {
    if (this.categoryIndex < this.retro.categories.length) {
      let delay = 0;
      if (this.voting) {
        console.log(`Voting: ${this.retro.categories[this.categoryIndex]}`);
        delay = this.retro.categoryTimes[this.retro.categories[this.categoryIndex]].voteTime;
        this.categoryIndex++;
      } else {
        console.log(`Polling: ${this.retro.categories[this.categoryIndex]}`);
        delay = this.retro.categoryTimes[this.retro.categories[this.categoryIndex]].selfTime;
      }

      this.voting = !this.voting;
      setTimeout(this.next.bind(this), delay * 60000);
    } else {
      console.log('All done!');
    }
  }
}

module.exports = RetroRunner;<commit_msg>Emit actual retro events; not quite all done<commit_after>class RetroRunner {
  constructor(socket, retroMetadata) {
    this.socket = socket;
    this.retro = retroMetadata;
    this.categoryIndex = 0;
    this.voting = false;
  }

  run() {
    this.socket.emit('starting retro', 10);
    this.categoryIndex = 0;
    this.voting = false;
    setTimeout(this.next.bind(this), 10000);
  }

  next() {
    if (this.categoryIndex < this.retro.categories.length) {
      const category = this.retro.categories[this.categoryIndex];
      let delay = 0;

      if (this.voting) {
        this.socket.emit('voting', { category, entries: [] });
        console.log(`Voting: ${category}`);
        delay = this.retro.categoryTimes[category].voteTime;
        this.categoryIndex++;
      } else {
        this.socket.emit('polling', category);
        console.log(`Polling: ${category}`);
        delay = this.retro.categoryTimes[category].selfTime;
      }

      this.voting = !this.voting;
      delay = delay * 60000;
      setTimeout(() => { this.socket.emit('10 second warning'); }, delay - 10000);
      setTimeout(this.next.bind(this), delay);
    } else {
      console.log('All done!');
    }
  }
}

module.exports = RetroRunner;
{'fraction_non_alphanumeric': 0.14764492753623187, 'fraction_numerical': 0.01358695652173913, 'mean_word_length': 2.802065404475043, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '3180103', 'n_tokens_mistral': 730, 'n_tokens_neox': 700, 'n_words': 120}