<commit_before>/* global _, window */

angular.module('hack4sweden').controller("StartCtrl", function($scope, $rootScope, $log, JobResource, settings) {
  $scope.state = {
    searchTerm: "",
    countyCode: 1,
    data: [],
    currentPage: 0,
    fetchingJobs: false,
    allJobsFetched: false
  };

  $scope.counties = settings.countyCodes;
  
  $scope.search = function() {
    $scope.state.data = [];
    window.scrollTo(0,0);

    $scope.state.searched = true;
    $rootScope.showLoading(true);
    $scope.getNextJobs();
  };

  $scope.getNextJobs = function() {
    if ($scope.state.fetchingJobs) {
      $log.debug('Will not fetch more jobs, still fetching jobs');
      return;
    }
    if ($scope.state.allJobsFetched) {
      $log.debug('Will not loading more, loaded all jobs');
      return;
    }
    $scope.state.fetchingJobs = true;<commit_msg>Fixed bug when doing more than one search<commit_after>/* global _, window */

angular.module('hack4sweden').controller("StartCtrl", function($scope, $rootScope, $log, JobResource, settings) {
  $scope.state = {
    searchTerm: "",
    countyCode: 1,
    data: [],
    currentPage: 0,
    fetchingJobs: false,
    allJobsFetched: false
  };

  $scope.counties = settings.countyCodes;
  
  $scope.search = function() {
    $scope.state.data = [];
    $scope.state.currentPage = 0;
    $scope.state.allJobsFetched = false;
    window.scrollTo(0,0);

    $scope.state.searched = true;
    $rootScope.showLoading(true);
    $scope.getNextJobs();
  };

  $scope.getNextJobs = function() {
    if ($scope.state.fetchingJobs) {
      $log.debug('Will not fetch more jobs, still fetching jobs');
      return;
    }
    if ($scope.state.allJobsFetched) {
      $log.debug('Will not loading more, loaded all jobs');
      return;
    }
    $scope.state.fetchingJobs = true;
{'fraction_non_alphanumeric': 0.15013698630136987, 'fraction_numerical': 0.006027397260273973, 'mean_word_length': 3.15, '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': '5878531', 'n_tokens_mistral': 629, 'n_tokens_neox': 622, 'n_words': 120}