<commit_before>'use strict';

angular.module('MathQuestions.worksheet', ['ngRoute','GreatMath.topic-distributor','GreatMath.question-generator'])

.config(['$routeProvider', function($routeProvider) {
  
  $routeProvider.when('/worksheet', {
    templateUrl: 'views/worksheet/worksheet.html',
    controller: 'WorksheetController'
  });
}])

.controller('WorksheetController', ['$scope','$sce','topicDistributor','questionGenerator',function($scope,$sce,topicDistributor,questionGenerator) {
  
  $scope.numberOfTimesTableQuestions     = 10;
  $scope.numberOfWorksheetsPerWeek       = 5;
  
  questionGenerator.setDefault(function(questionSpec,callback){
    callback(null,"Placeholder for " + questionSpec.class + " topic " + questionSpec.topicId);
  });
  
  topicDistributor.createDistribution(function(distribution){
    $scope.$apply(function(){
      
      $scope.generate = function (){
        var promise = {
          then:function(callback){
            this.callback=callback;
          },
          resolve:function(){
            var self=this;
            setTimeout(function(){
              self.callback();
            },0);
          }
        }
        $scope.weeks = [];
        var numberOfQuestionsToGenerate = 0;
        distribution.weeks.forEach(function(week,weekIndex){
          week.mentalStrategies.topics.forEach(function(topic,topicIndex){
            numberOfQuestionsToGenerate = numberOfQuestionsToGenerate + $scope.numberOfWorksheetsPerWeek;
          });
          week.timesTable.questionSpecs.forEach(function(questionSpec,questionIndex){
            numberOfQuestionsToGenerate = numberOfQuestionsToGenerate + $scope.numberOfWorksheetsPerWeek;
          });          
        });
        if(numberOfQuestionsToGenerate==0){
          promise.resolve();
        }else{
          distribution.weeks.forEach(function(week,weekIndex){<commit_msg>console error<commit_after>'use strict';

angular.module('MathQuestions.worksheet', ['ngRoute','GreatMath.topic-distributor','GreatMath.question-generator'])

.config(['$routeProvider', function($routeProvider) {
  
  $routeProvider.when('/worksheet', {
    templateUrl: 'views/worksheet/worksheet.html',
    controller: 'WorksheetController'
  });
}])

.controller('WorksheetController', ['$scope','$sce','topicDistributor','questionGenerator',function($scope,$sce,topicDistributor,questionGenerator) {
  
  $scope.numberOfTimesTableQuestions     = 10;
  $scope.numberOfWorksheetsPerWeek       = 5;
  
  questionGenerator.setDefault(function(questionSpec,callback){
    callback(null,"Placeholder for " + questionSpec.class + " topic " + questionSpec.topicId);
  });
  
  topicDistributor.createDistribution(function(distribution){
    $scope.$apply(function(){
      
      $scope.generate = function (){
        var promise = {
          then:function(callback){
            this.callback=callback;
          },
          resolve:function(){
            var self=this;
            setTimeout(function(){
              if(self.callback){
                self.callback();
              }
            },0);
          }
        }
        $scope.weeks = [];
        var numberOfQuestionsToGenerate = 0;
        distribution.weeks.forEach(function(week,weekIndex){
          week.mentalStrategies.topics.forEach(function(topic,topicIndex){
            numberOfQuestionsToGenerate = numberOfQuestionsToGenerate + $scope.numberOfWorksheetsPerWeek;
          });
          week.timesTable.questionSpecs.forEach(function(questionSpec,questionIndex){
            numberOfQuestionsToGenerate = numberOfQuestionsToGenerate + $scope.numberOfWorksheetsPerWeek;
          });          
        });
        if(numberOfQuestionsToGenerate==0){
          promise.resolve();
        }else{
          distribution.weeks.forEach(function(week,weekIndex){
{'fraction_non_alphanumeric': 0.1254255040586541, 'fraction_numerical': 0.003142183817753339, 'mean_word_length': 3.0943193997856375, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7309115', 'n_tokens_mistral': 1038, 'n_tokens_neox': 990, 'n_words': 109}