<commit_before>import { TimekeeperController } from '../common';
import template from './timer.component.html';
import './timer.component.scss';

export default function TimerComponent(appModule) {
  appModule.component('atTimer', {
    template: template,
    controller: TimerController
  });
}

class TimerController extends TimekeeperController {
  constructor($filter, $interval, $scope, timerService, voiceService) {
    'ngInject';
    super(...arguments);
  }

  changeTime() {
    this.time = this.minInput * 60 + this.secInput;
  }

  reset() {
    super.reset();
    this.minInput = undefined;
    this.secInput = undefined;
  }

  _intervalFn() {
    if (this.time <= 0) {
      this.time = 0;
      this.pause();
      this.reset();
      return;
    }
    this.time--;
    // if (this.time === 1 || this.time % 10 === 0) {
      let phrase = this._voiceService.getTimePhrase(this.time);
      this._voiceService.speak(phrase);
    // }
  }
}
<commit_msg>Timer voice speaks before time update<commit_after>import { TimekeeperController } from '../common';
import template from './timer.component.html';
import './timer.component.scss';

export default function TimerComponent(appModule) {
  appModule.component('atTimer', {
    template: template,
    controller: TimerController
  });
}

class TimerController extends TimekeeperController {
  constructor($filter, $interval, $scope, timerService, voiceService) {
    'ngInject';
    super(...arguments);
  }

  changeTime() {
    this.time = this.minInput * 60 + this.secInput;
  }

  reset() {
    super.reset();
    this.minInput = undefined;
    this.secInput = undefined;
  }

  _intervalFn() {
    if (this.time <= 0) {
      this.time = 0;
      this.pause();
      this.reset();
      return;
    }
    // if (this.time === 1 || this.time % 10 === 0) {
      let phrase = this._voiceService.getTimePhrase(this.time);
      this._voiceService.speak(phrase);
    // }
    this.time--;
  }
}

{'fraction_non_alphanumeric': 0.1489795918367347, 'fraction_numerical': 0.00816326530612245, 'mean_word_length': 2.922, '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': '6697486', 'n_tokens_mistral': 626, 'n_tokens_neox': 597, 'n_words': 127}