<commit_before>require(
['ext/jquery'],
function($) {
  var POLLING_DELAY = 60000;

  var pollStats = function() {
    console.log('this is actually hapnnieng');
    $.post(
      '/admin/api/generic-stats',
      {},
      function(resp) {
        // TODO(Sandy) : User actions (ratings/reviews) in the past day/hour etc
        // Last x users signed up
        // last x reivews/ratings
        $('#num_users').text(resp.num_users);
        $('#num_signups_today').text(resp.num_signups_today);
        $('#num_users_with_transcript').text(resp.num_users_with_transcript);
        $('#num_ucs').text(resp.num_ucs);
        setLastUpdatedTime(resp.epoch.$date);
      },
      'json'
    );
    setTimeout(pollStats, POLLING_DELAY);
  };

  var setLastUpdatedTime = function(time) {
    $('#last_updated').text(moment(time).toString());
  };

  var init = function() {
    setLastUpdatedTime(window.pageData.epoch.$date);
    setTimeout(pollStats, POLLING_DELAY);
  };

  $(init);
});<commit_msg>Make dashboard only poll for an hour at a time, incase we leave tabs open<commit_after>require(
['ext/jquery'],
function($) {
  var POLLING_DELAY = 60000;
  // Stop refreshing after an hour, incase we leave tabs open :(
  var CUTOFF_COUNT = 60;

  var timesRefreshed = 0;
  var pollStats = function() {
    console.log('this is actually hapnnieng');
    $.post(
      '/admin/api/generic-stats',
      {},
      function(resp) {
        // TODO(Sandy) : User actions (ratings/reviews) in the past day/hour etc
        // Last x users signed up
        // last x reivews/ratings
        $('#num_users').text(resp.num_users);
        $('#num_signups_today').text(resp.num_signups_today);
        $('#num_users_with_transcript').text(resp.num_users_with_transcript);
        $('#num_ucs').text(resp.num_ucs);
        setLastUpdatedTime(resp.epoch.$date);
      },
      'json'
    );
    timesRefreshed += 1;
    if (timesRefreshed < CUTOFF_COUNT) {
      setTimeout(pollStats, POLLING_DELAY);
    }
  };

  var setLastUpdatedTime = function(time) {
    $('#last_updated').text(moment(time).toString());
  };

  var init = function() {
    setLastUpdatedTime(window.pageData.epoch.$date);
    setTimeout(pollStats, POLLING_DELAY);
  };

  $(init);
});
{'fraction_non_alphanumeric': 0.15316117542297417, 'fraction_numerical': 0.006233303650934996, 'mean_word_length': 3.055956678700361, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4866360', 'n_tokens_mistral': 769, 'n_tokens_neox': 745, 'n_words': 139}