<commit_before>define(['angular','services','timey','parameterCheck'],function(angular,services,timey,parameterCheck){
  'use strict';
  /* Controllers */
  var TWENTY_FIVE_IN_MILLIS_EPOCH = 1500000;
  var FIVE_IN_MILLIS_EPOCH = 300000;
  var TEN_IN_MILLIS_EPOCH = 600000;
  
  var pomodoroControllers = angular.module('pomodoro.controllers', ['pomodoro.services']);
  
  pomodoroControllers.controller('pomodoroCtrl', ['$scope','$routeParams','$interval',
     //TODO make this an async function
    function($scope,$routeParams,$interval){
      var timer = Object.create(timey);
      console.log(timer);

      $scope.timerDisplay = {
	      timeRemaining : "00:00:00",
              editorActive : false,
      };

      $scope.completedTimes = [];

      //controller interface internals
      var getMillisFromInput = function(inputHours,inputMins,inputSecs){
	      var hoursMillis = 0;
	      var minuteMillis = 0;
	      var secMillis = 0;
	      if(!(inputHours === null || inputHours === undefined)){
		      hoursMillis = inputHours*60*60*1000;
	      }
	      if(!(inputMins === null || inputMins === undefined)){
		      minuteMillis = inputMins*60*1000;
	      }
	      if(!(inputSecs === null || inputSecs === undefined)){
		      secMillis = inputSecs*1000;
	      }
	      return hoursMillis + minuteMillis + secMillis;
      };

      var setEditorInactive = function(){
	      $scope.timerDisplay.editorActive = false;
      };

      var twoDigits = function(inputDigits){
          return parseInt(inputDigits.toString().substring(0,2));
      };

      var nullOrUndefined = function(value){
	      return value === null || value === undefined;
      };

      var addCompleted = function(timerFinishedEventObj){
	      if(timerFinishedEventObj.completedCountdownMillis >= 1000){
	        $scope.completedTimes.push({
	                time : timer.getHourMinuteSecondString(timerFinishedEventObj.completedCountdownMillis),
	                at : timer.getLocalTimeString(timerFinishedEventObj.finishedAt),
	        });
	      }
      };
      timer.registerObserver(addCompleted);

      //update the display frequently
      $interval(function(){
      	$scope.timerDisplay.timeRemaining = timer.getHourMinuteSecondRemainString();
      },20,0,true);


      //controller interface
      $scope.startTimer = function(){
         var inputMillis = getMillisFromInput($scope.timerDisplay.inputHours,$scope.timerDisplay.inputMinutes,$scope.timerDisplay.inputSeconds);
	 if(inputMillis === null){
           timer.startTimer(TWENTY_FIVE_IN_MILLIS_EPOCH);
	   return;
	 }
	 timer.startTimer(inputMillis);
      };

      $scope.startTimerFromEditor = function(){
	      $scope.startTimer();
	      setEditorInactive();
      };

      $scope.hourMask = function(){
	      if(!nullOrUndefined($scope.timerDisplay.inputHours)){<commit_msg>timer display inputs cleared when timer started<commit_after>define(['angular','services','timey','parameterCheck'],function(angular,services,timey,parameterCheck){
  'use strict';
  /* Controllers */
  var TWENTY_FIVE_IN_MILLIS_EPOCH = 1500000;
  var FIVE_IN_MILLIS_EPOCH = 300000;
  var TEN_IN_MILLIS_EPOCH = 600000;
  
  var pomodoroControllers = angular.module('pomodoro.controllers', ['pomodoro.services']);
  
  pomodoroControllers.controller('pomodoroCtrl', ['$scope','$routeParams','$interval',
     //TODO make this an async function
    function($scope,$routeParams,$interval){
      var timer = Object.create(timey);
      console.log(timer);

      $scope.timerDisplay = {
	      timeRemaining : "00:00:00",
              editorActive : false,
      };

      $scope.completedTimes = [];

      //controller interface internals
      var getMillisFromInput = function(inputHours,inputMins,inputSecs){
	      var hoursMillis = 0;
	      var minuteMillis = 0;
	      var secMillis = 0;
	      if(!(inputHours === null || inputHours === undefined)){
		      hoursMillis = inputHours*60*60*1000;
	      }
	      if(!(inputMins === null || inputMins === undefined)){
		      minuteMillis = inputMins*60*1000;
	      }
	      if(!(inputSecs === null || inputSecs === undefined)){
		      secMillis = inputSecs*1000;
	      }
	      return hoursMillis + minuteMillis + secMillis;
      };

      var setEditorInactive = function(){
	      $scope.timerDisplay.editorActive = false;
      };

      var twoDigits = function(inputDigits){
          return parseInt(inputDigits.toString().substring(0,2));
      };

      var nullOrUndefined = function(value){
	      return value === null || value === undefined;
      };

      var addCompleted = function(timerFinishedEventObj){
	      if(timerFinishedEventObj.completedCountdownMillis >= 1000){
	        $scope.completedTimes.push({
	                time : timer.getHourMinuteSecondString(timerFinishedEventObj.completedCountdownMillis),
	                at : timer.getLocalTimeString(timerFinishedEventObj.finishedAt),
	        });
	      }
      };
      timer.registerObserver(addCompleted);

      //update the display frequently
      $interval(function(){
      	$scope.timerDisplay.timeRemaining = timer.getHourMinuteSecondRemainString();
      },20,0,true);


      //controller interface
      $scope.startTimer = function(){
         var inputMillis = getMillisFromInput($scope.timerDisplay.inputHours,
			 $scope.timerDisplay.inputMinutes,
			 $scope.timerDisplay.inputSeconds);
	 if(inputMillis === null){
           timer.startTimer(TWENTY_FIVE_IN_MILLIS_EPOCH);
	   return;
	 }
	 //clear inputs
	 $scope.timerDisplay.inputHours = 0;
	 $scope.timerDisplay.inputMinutes = 0;
	 $scope.timerDisplay.inputSeconds = 0;
	 timer.startTimer(inputMillis);
      };

      $scope.startTimerFromEditor = function(){
	      $scope.startTimer();
	      setEditorInactive();
      };

      $scope.hourMask = function(){
	      if(!nullOrUndefined($scope.timerDisplay.inputHours)){
{'fraction_non_alphanumeric': 0.12374809030724834, 'fraction_numerical': 0.019181802749957563, 'mean_word_length': 3.097357440890125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5484606', 'n_tokens_mistral': 1872, 'n_tokens_neox': 1710, 'n_words': 273}