<commit_before>'use strict';

var consoleApp = angular.module('ConsoleApp', []);

consoleApp.controller('ConsoleCtrl', function($scope, $http, $interval) {
  
  $scope.orderNumber = 1000;
  
  $scope.submitOrder = function() {
    $scope.orders.push($scope.orderNumber);
    $scope.times.push(Date.now());
  };
  
  $scope.orders = [];
  
  $scope.times = [];
  
  $scope.timeString = function(time) {
    return new Date(time).toLocaleTimeString();
  };
  
  $scope.currentTime = Date.now();
  
  var update = function() {
    $scope.currentTime = Date.now();
    
    for (var t in $scope.times) {
      if (($scope.times[t] + (5 * 60 * 1000)) < $scope.currentTime) {
        $scope.times = $scope.times.slice(1);
        $scope.orders = $scope.orders.slice(1);
      }
    }
  }
  
  $interval(update, 1000);
  
});<commit_msg>made the console use the API<commit_after>'use strict';

var consoleApp = angular.module('ConsoleApp', []);

consoleApp.controller('ConsoleCtrl', function($scope, $http, $interval) {
  
  $scope.orderNumber = 1000;
  
  $scope.submitOrder = function() {
    $http.post("order?orderNumber=" + $scope.orderNumber + "&apikey=bogus");
  };
  
  $scope.orders = [];
  
  $scope.times = [];
  
  $scope.timeString = function(time) {
    return new Date(time).toLocaleTimeString();
  };
  
  $scope.currentTime = Date.now();
  
  var update = function() {
    $scope.currentTime = Date.now();
    
    $http.get("order?count=100&apikey=bogus")
        .success(function(data) {
            $scope.orders = [];
            $scope.times = [];
            for (var i in data.orders) {
                $scope.orders.push(data.orders[i].orderNumber);
                $scope.times.push(data.orders[i].timeCreated)
            }});
    
  }
  
  $interval(update, 1000);
  
});
{'fraction_non_alphanumeric': 0.177356385945343, 'fraction_numerical': 0.015616285554935862, 'mean_word_length': 2.7453027139874737, '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': '2538333', 'n_tokens_mistral': 629, 'n_tokens_neox': 602, 'n_words': 94}