<commit_before>'use strict';

angular.module('MathQuestions.questionPreview', ['ngRoute','GreatMath.question-generator'])

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

.controller('QuestionPreviewController', ['$scope','questionGenerator','topicRegistry',function($scope,questionGenerator,topicRegistry) {
  $scope.topicId=1;
  topicRegistry.getTopics(function(topics){
    $scope.$apply(function(){
      $scope.availableTopics = topics;      
    });
  });

  function populateQuestion(){
    questionGenerator.generate(
    {
      class : "mentalStrategies",
      topicId    : $scope.selectedTopic
    },
    function(err,question){
      $scope.$apply(function(){
        $scope.question=question;
      });      
    });
  }
  $scope.$watch(
    function(){
      return $scope.selectedTopic;
    },
    function(){
      populateQuestion();
    }
  );
  
  setInterval(populateQuestion,500);
}]);<commit_msg>another hack for topic id<commit_after>'use strict';

angular.module('MathQuestions.questionPreview', ['ngRoute','GreatMath.question-generator'])

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

.controller('QuestionPreviewController', ['$scope','questionGenerator','topicRegistry',function($scope,questionGenerator,topicRegistry) {
  $scope.topicId=1;
  topicRegistry.getTopics(function(topics){
    $scope.$apply(function(){
      $scope.availableTopics = topics;      
    });
  });

  function populateQuestion(){
    questionGenerator.generate(
    {
      class : "mentalStrategies",
      topicId    : $scope.selectedTopic-1
    },
    function(err,question){
      $scope.$apply(function(){
        $scope.question=question;
      });      
    });
  }
  $scope.$watch(
    function(){
      return $scope.selectedTopic;
    },
    function(){
      populateQuestion();
    }
  );
  
  setInterval(populateQuestion,500);
}]);
{'fraction_non_alphanumeric': 0.15633546034639928, 'fraction_numerical': 0.004102096627164996, 'mean_word_length': 3.8995535714285716, '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': '2399081', 'n_tokens_mistral': 632, 'n_tokens_neox': 618, 'n_words': 74}