<commit_before>(function () {
    'use strict';

    var easyCountDown = angular.module('easyCountDown', []);

    easyCountDown.controller('CountDownController', ['$scope', '$interval', function($scope, $interval){
        CountDownController.$inject = ['$scope', '$interval'];

        function CountDownController($scope, $interval) {
            this.$scope = $scope;
            this.$interval = $interval;
        }
        CountDownController.prototype.init = function () {
            var endDate = new Date($scope.endDate);
            if (!(endDate instanceof Date)) {
                return;
            }
            if (isNaN(endDate.getTime())) {
                return;
            }
            this.intervalReff = $interval(function () {
                var startDate = new Date(), diff = (Number(endDate) - Number(startDate)) / 1000, days = Math.floor(diff / 86400), hours, minutes;
                if (0 < diff) {
                    diff -= days * 86400;
                    hours = Math.floor(diff / 3600) % 24;
                    diff -= hours * 3600;
                    minutes = Math.floor(diff / 60) % 60;
                }
                else {
                    days = hours = minutes = 0;
                    _this.destroyInterval();
                }
                $scope.days = days;
                $scope.counter = days.toString() + ":" +
                    ('0' + hours.toString()).substr(-2) + ":" +
                    ('0' + minutes.toString()).substr(-2);
            }, 1000);
            $scope.$on("$destroy", function () {
                this.destroyInterval();
            });
        };
        CountDownController.prototype.range = function (n) {
            return new Array(n);
        };
        CountDownController.prototype.destroyInterval = function () {
            if (angular.isDefined(this.intervalReff)) {
                $interval.cancel(this.intervalReff);
                this.intervalReff = undefined;
            }
        };
        CountDownController.controllerId = "CountDownController";
        return CountDownController;
    }]);
    easyCountDown.directive('easyCountDownDirective', ['$interval', function($interval) {
        return {
            restrict: 'A',
            template:   '<div ng-controller="ctrl" >' +
                            '<div class="outer" id="stopWatch">' +
                                '<div class="counter">{{counter}}</div>' +
                                '<div class="points" style="-moz-transform: rotate({{90 + $index * 6}}deg); -ms-transform: rotate({{90 + $index * 6}}deg); -webkit-transform: rotate({{90 + $index * 6}}deg); transform: rotate({{90 + $index * 6}}deg);" ng-repeat="a in ctrl.prototype.range(30) track by $index">' +
                                    '<div class="circle floatRight" ng-class="{\'activePoint\': days > ($index + 30), \'inactivePoint\': days <= ($index + 30)}"></div>' +
                                    '<div class="squere floatRight" ng-class="{\'activePoint\': days > ($index + 30), \'inactivePoint\': days <= ($index + 30)}"></div>' +
                                    '<div class="circle floatLeft" ng-class="{\'activePoint\': days > $index, \'inactivePoint\': days <= $index}"></div>' +
                                    '<div class="squere floatLeft" ng-class="{\'activePoint\': days > $index, \'inactivePoint\': days <= $index}"></div>' +
                                 '</div>' +
                            '</div>' +
                        '</div>',
            controller: 'CountDownController',
            controllerAs: 'ctrl',
            scope : {
                endDate: '@'
            },
            link : function($scope, element, attributes, ctrl) {
                ctrl.prototype.init();
            }
        }
    }]);

})();<commit_msg>Fixed directive and controller for easy counter<commit_after>(function () {
    'use strict';

    var easyCountDown = angular.module('easyCountDown', []);

    easyCountDown.controller('CountDownController', ['$scope', '$interval',
        function($scope, $interval) {

          function destroyInterval () {
              if (angular.isDefined($scope.intervalReff)) {
                  $interval.cancel($scope.intervalReff);
                  $scope.intervalReff = undefined;
              }
          };

          var endDate = new Date($scope.endDate);
          if (!(endDate instanceof Date)) {
              return;
          }
          if (isNaN(endDate.getTime())) {
              return;
          }

          $scope.intervalReff = $interval(function () {
              var hours, minutes,
                  startDate = new Date(),
                  diff = (Number(endDate) - Number(startDate)) / 1000, days = Math.floor(diff / 86400)
              ;

              if (0 < diff) {
                  diff -= days * 86400;
                  hours = Math.floor(diff / 3600) % 24;
                  diff -= hours * 3600;
                  minutes = Math.floor(diff / 60) % 60;
              } else {
                  days = hours = minutes = 0;
                  destroyInterval();
              }

              $scope.days = days;
              $scope.counter = days.toString() + ":" + ('0' + hours.toString()).substr(-2) + ":" + ('0' + minutes.toString()).substr(-2);
          }, 1000);

          $scope.$on("$destroy", function () {
              destroyInterval();
          });

          return {
            range: function (n) {
              return new Array(n);
            }
          }
        }
      ]);

    easyCountDown.directive('easyCountDownDirective', function() {
        return {
            restrict: 'A',
            template:   '<div ng-controller="CountDownController as ctrl" >' +
                            '<div class="outer" id="stopWatch">' +
                                '<div class="counter">{{counter}}</div>' +
                                '<div class="points" style="-moz-transform: rotate({{90 + $index * 6}}deg); -ms-transform: rotate({{90 + $index * 6}}deg); -webkit-transform: rotate({{90 + $index * 6}}deg); transform: rotate({{90 + $index * 6}}deg);" ng-repeat="a in ctrl.range(30) track by $index">' +
                                    '<div class="circle floatRight" ng-class="{\'activePoint\': days > ($index + 30), \'inactivePoint\': days <= ($index + 30)}"></div>' +
                                    '<div class="squere floatRight" ng-class="{\'activePoint\': days > ($index + 30), \'inactivePoint\': days <= ($index + 30)}"></div>' +
                                    '<div class="circle floatLeft" ng-class="{\'activePoint\': days > $index, \'inactivePoint\': days <= $index}"></div>' +
                                    '<div class="squere floatLeft" ng-class="{\'activePoint\': days > $index, \'inactivePoint\': days <= $index}"></div>' +
                                 '</div>' +
                            '</div>' +
                        '</div>',
            controller: 'CountDownController',
            scope : {
                endDate: '@'
            }
        }
    });

})();
{'fraction_non_alphanumeric': 0.1610085927595436, 'fraction_numerical': 0.016903789266093816, 'mean_word_length': 1.5097207493814069, 'pattern_counts': {'":': 4, '<': 45, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '611700', 'n_tokens_mistral': 1968, 'n_tokens_neox': 1820, 'n_words': 374}