<commit_before>angular.module('algorea')
  .directive('contestTimer', ['contestTimerService', 'pathService', '$state', function (contestTimerService, pathService, $state) {
  	'use strict';
    return {
      restrict: 'EA',
      scope: true,
      template: '<span class="contestTimer">{{timerStr}}</span>',
      link: function(scope, elem, attrs){
      	scope.timerStr = '';
      	var updateCallback = function(minutesOrType, seconds) {
      		var newTimerStr = '';
      		if (minutesOrType == 'sync') {
      			newTimerStr = 'synchronisation...';
      		} else {
      			if (minutesOrType == '0' && seconds == '00') {
      				newTimerStr = '';
      			} else {
      				newTimerStr = minutesOrType+':'+seconds;
      			}
      		}
      		scope.$applyAsync(function() {scope.timerStr = newTimerStr;});
      	};
      	var contestOverCallback = function() {
      		scope.$applyAsync(function() {
      			scope.timerStr = '';
      			//alert('Le concours est terminé !');
            SyncQueue.planToSend(0);

						var pathParams = pathService.getPathParams();
						var path = pathParams.path.slice(0, pathParams.path.length - 1).join('/');
						$state.go('contents', {path: path});
      		});
      	};
      	contestTimerService.connect(updateCallback, contestOverCallback);
      }
    };
}]);<commit_msg>when time limit is over then redirect to the ancestor item<commit_after>angular.module('algorea')
  .directive('contestTimer', ['contestTimerService', 'pathService', '$state', function (contestTimerService, pathService, $state) {
  	'use strict';
    return {
      restrict: 'EA',
      scope: true,
      template: '<span class="contestTimer">{{timerStr}}</span>',
      link: function(scope, elem, attrs){
      	scope.timerStr = '';
      	var updateCallback = function(minutesOrType, seconds) {
      		var newTimerStr = '';
      		if (minutesOrType == 'sync') {
      			newTimerStr = 'synchronisation...';
      		} else {
      			if (minutesOrType == '0' && seconds == '00') {
      				newTimerStr = '';
      			} else {
      				newTimerStr = minutesOrType+':'+seconds;
      			}
      		}
      		scope.$applyAsync(function() {scope.timerStr = newTimerStr;});
      	};
      	var contestOverCallback = function() {
      		scope.$applyAsync(function() {
      			scope.timerStr = '';
      			//alert('Le concours est terminé !');
            SyncQueue.planToSend(0);

						var pathParams = pathService.getPathParams();
						var sell = Math.min(pathParams.path.length - 1, pathParams.sell);
						var path = pathParams.path.slice(0, sell).join('/');
						$state.go('contents', {path: path, sell: sell, selr: null});
      		});
      	};
      	contestTimerService.connect(updateCallback, contestOverCallback);
      }
    };
}]);
{'fraction_non_alphanumeric': 0.154980222941388, 'fraction_numerical': 0.004314994606256742, 'mean_word_length': 2.530456852791878, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4100480', 'n_tokens_mistral': 933, 'n_tokens_neox': 865, 'n_words': 160}