<commit_before>﻿angular.module('sar-database').controller("TrainingUploadRecordsCtrl", ['$scope', '$http', '$timeout', '$q', '$mdToast', 'Upload', function ($scope, $http, $timeout, $q, $mdToast, Upload) {
  angular.extend($scope, {
    parsed: [],
    selected: function selected() {
      return $scope.parsed.filter(function (item) { return item.selected });
    },
    upload: function upload(file) {
      if (file && !file.$error) {
        $scope.uploading = true;
        $scope.progress = Upload.upload({
          url: 'https://kcsara-api2.azurewebsites.net/ParseKcsaraCsv',
          data: {
            file: file
          }
        }).then(function (resp) {
          $timeout(function () {
            $scope.uploading = false;
            for (var i = 0; i < resp.data.length; i++) { resp.data[i].selected = !resp.data[i].error && !resp.data[i].existing; resp.data[i].completed = moment(resp.data[i].completed) }
            $scope.parsed = resp.data;
            $scope.log = 'file: ' +
            resp.config.data.file.name +
            ', Response: ' + JSON.stringify(resp.data) +
            '\n' + $scope.log;
          });<commit_msg>fix training uploads<commit_after>﻿angular.module('sar-database').controller("TrainingUploadRecordsCtrl", ['$scope', '$http', '$timeout', '$q', '$mdToast', 'Upload', function ($scope, $http, $timeout, $q, $mdToast, Upload) {
  angular.extend($scope, {
    parsed: [],
    selected: function selected() {
      return $scope.parsed.filter(function (item) { return item.selected });
    },
    upload: function upload(file) {
      if (file && !file.$error) {
        $scope.uploading = true;
        $scope.progress = Upload.upload({
          url: 'https://kcsara-api2.azurewebsites.net/trainingrecords/ParseKcsaraCsv',
          data: {
            file: file
          }
        }).then(function (resp) {
          $timeout(function () {
            $scope.uploading = false;
            for (var i = 0; i < resp.data.length; i++) { resp.data[i].selected = !resp.data[i].error && !resp.data[i].existing; resp.data[i].completed = moment(resp.data[i].completed) }
            $scope.parsed = resp.data;
            $scope.log = 'file: ' +
            resp.config.data.file.name +
            ', Response: ' + JSON.stringify(resp.data) +
            '\n' + $scope.log;
          });
{'fraction_non_alphanumeric': 0.1791363830696879, 'fraction_numerical': 0.0017101325352714834, 'mean_word_length': 2.4011627906976742, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6612871', 'n_tokens_mistral': 727, 'n_tokens_neox': 720, 'n_words': 132}