<commit_before>var blocTime = angular.module('bloctime', ['ui.router']);

blocTime.config(['$stateProvider', '$locationProvider', function($stateProvider, $locationProvider) {
  $locationProvider.html5Mode(true);
  $stateProvider.state('home', {
    url: '/',
    controller: 'HomeController',
    templateUrl: '/templates/home.html'
  });
}]);

blocTime.controller('HomeController', ['$scope', '$interval', function($scope, $interval) {
  $scope.title = "Welcome to Bloc Time!";
  $scope.time = 65;
  $scope.buttonLabel = "Start";
  $scope.timeString = "" + $scope.time;
  var countDown = function() {
    $scope.time -= 1;
    $scope.buttonLabel = "Reset";
    if ($scope.time == 0) {
      $interval.cancel(interval);
    }
    // See Bloc Jams Filter
    $scope.timeString = parseInt($scope.time/60, 10) + ":" + ($scope.time % 60);
  }

  var interval = $interval(countDown, 1000);
}]);<commit_msg>add filter to properly format and display time<commit_after>var blocTime = angular.module('bloctime', ['ui.router']);

blocTime.config(['$stateProvider', '$locationProvider', function($stateProvider, $locationProvider) {
  $locationProvider.html5Mode(true);
  $stateProvider.state('home', {
    url: '/',
    controller: 'HomeController',
    templateUrl: '/templates/home.html'
  });
}]);

blocTime.controller('HomeController', ['$scope', '$interval', '$filter', function($scope, $interval, $filter) {
  $scope.title = "Welcome to Bloc Time!";
  $scope.time = 65;
  $scope.buttonLabel = "Start";
  // $scope.timeString = "" + $scope.time;
  var countDown = function() {
    $scope.time -= 1;
    $scope.buttonLabel = "Reset";
    if ($scope.time == 0) {
      $interval.cancel(interval);
    }
    $scope.timeString = $filter('remainingTime')($scope.time);
  }

  var interval = $interval(countDown, 1000);
}]);

blocTime.filter('remainingTime', function() {
  return function(seconds) {
    seconds = Number.parseFloat(seconds);
    if (Number.isNaN(seconds)) {
      return '-:--';
    }
    var wholeSeconds = Math.floor(seconds);
    var minutes = Math.floor(wholeSeconds / 60);
    remainingSeconds = wholeSeconds % 60;
    var output = minutes + ':';
    if (remainingSeconds < 10) {
      output += '0';
    }
    output += remainingSeconds;
    return output;
  }
})
{'fraction_non_alphanumeric': 0.18181818181818182, 'fraction_numerical': 0.013614404918752744, 'mean_word_length': 3.920086393088553, 'pattern_counts': {'":': 1, '<': 4, '<?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': '3347710', 'n_tokens_mistral': 753, 'n_tokens_neox': 719, 'n_words': 143}