<commit_before>angular.module('chooie').controller("LogController", ['$scope', 'LogService', 'ClientMessenger',
    function($scope, logService, clientMessenger) {

        var createLogViewModel = function(logMessage) {
            switch(logMessage.Severity) {
                case 0:
                    logMessage.Severity = "Info";
                    break;
                case 1:
                    logMessage.Severity = "Warning";
                    break;
                case 2:
                    logMessage.Severity = "Error";
                    break;
                default:
                    logMessage.Severity = "Unknown";
            }
            var time = new Date(parseInt(logMessage.Time.replace("/Date(", "").replace(")/",""), 10));
            logMessage.Time = time.toLocaleTimeString();
            return logMessage;
        };

        var getLogPromise = logService.getLog().success(function(logMessages) {
            $scope.logMessages = logMessages.map(createLogViewModel);
        });

        var addNewLogMessage = function(newLogMessageJson) {
            var newLogMessage = JSON.parse(newLogMessageJson);
            getLogPromise.success(function() {
                $scope.logMessages.push(createLogViewModel(newLogMessage));
            })
        };

        clientMessenger.registerCallback("Log Message", addNewLogMessage);
    }]);<commit_msg>Temporary fix for #11 DateTimes incorrect in UI<commit_after>angular.module('chooie').controller("LogController", ['$scope', 'LogService', 'ClientMessenger',
    function($scope, logService, clientMessenger) {

        var getDateFromLogTimeString = function(timeString) {
            if(timeString.indexOf("/Date") !== -1) {
                return new Date(parseInt(timeString.replace("/Date(", "").replace(")/",""), 10))
            }
            return new Date(timeString);
        };

        var createLogViewModel = function(logMessage) {
            switch(logMessage.Severity) {
                case 0:
                    logMessage.Severity = "Info";
                    break;
                case 1:
                    logMessage.Severity = "Warning";
                    break;
                case 2:
                    logMessage.Severity = "Error";
                    break;
                default:
                    logMessage.Severity = "Unknown";
            }
            var time = getDateFromLogTimeString(logMessage.Time);
            logMessage.Time = time.toLocaleTimeString();
            return logMessage;
        };

        var getLogPromise = logService.getLog().success(function(logMessages) {
            $scope.logMessages = logMessages.map(createLogViewModel);
        });

        var addNewLogMessage = function(newLogMessageJson) {
            var newLogMessage = JSON.parse(newLogMessageJson);
            getLogPromise.success(function() {
                $scope.logMessages.push(createLogViewModel(newLogMessage));
            })
        };

        clientMessenger.registerCallback("Log Message", addNewLogMessage);
    }]);
{'fraction_non_alphanumeric': 0.11205211726384365, 'fraction_numerical': 0.004234527687296417, 'mean_word_length': 1.822610294117647, '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': '2129107', 'n_tokens_mistral': 800, 'n_tokens_neox': 744, 'n_words': 127}