<commit_before>define(['app', 'underscore', '/app/views/search-new/search-results/record-viewer.js',
        '/app/js/common.js', '/app/services/role-service.js', 'toastr',
          'scbd-branding/directives/xuser-notifications-panel',
], function(app, _) {
 "use strict";
    app.controller("recordHistoryController", ["$rootScope", "$scope", "$filter", "$routeParams", "IStorage", "$q",
     "IWorkflows", "IUserNotifications", "commonjs", "$element", "$timeout", "roleService", "toastr", "$location",
        function($rootScope, $scope, $filter, $routeParams, IStorage, $q, IWorkflows,
            IUserNotifications, commonjs, $element, $timeout, roleService, toastr, $location) {


            if ($routeParams.document_type) {
                $scope.document = {
                    schema : $filter("mapSchema")($routeParams.document_type),
                    identifier : $routeParams.identifier
                };

                $q.when(IStorage.drafts.locks.get($routeParams.identifier,{lockID:''}))
                .then(function(data){
                        var doc = data.data[0];
                        if(doc && doc.lockID){
                            doc.workflwoId = doc.lockID.replace('workflow-','');
                            $scope.showRequestHistory = true;
                            _.extend($scope.document, doc);
                            if(doc.lockedBy.userID == $rootScope.user.userID)
                                $scope.canRecall = true;
                        }
                });

                // var documentNotificationsQuery = {
                //     $and : [{"data.documentInfo.identifier": $scope.document.identifier}]
                // };
                // IUserNotifications.query(documentNotificationsQuery, 0, 100)
                //     .then(function(data) {
                //         if (!data || data.length === 0)
                //             return;
                //         $scope.documentNotifications = data;
                //     });<commit_msg>handle workflowUpdate event<commit_after>define(['app', 'underscore', '/app/views/search-new/search-results/record-viewer.js',
        '/app/js/common.js', '/app/services/role-service.js', 'toastr',
          'scbd-branding/directives/xuser-notifications-panel',
], function(app, _) {
 "use strict";
    app.controller("recordHistoryController", ["$rootScope", "$scope", "$filter", "$routeParams", "IStorage", "$q",
     "IWorkflows", "IUserNotifications", "commonjs", "$element", "$timeout", "roleService", "toastr", "$location",
        function($rootScope, $scope, $filter, $routeParams, IStorage, $q, IWorkflows,
            IUserNotifications, commonjs, $element, $timeout, roleService, toastr, $location) {


            if ($routeParams.document_type) {
                $scope.document = {
                    schema : $filter("mapSchema")($routeParams.document_type),
                    identifier : $routeParams.identifier
                };

                $q.when(IStorage.drafts.locks.get($routeParams.identifier,{lockID:''}))
                .then(function(data){
                        var doc = data.data[0];
                        if(doc && doc.lockID){
                            doc.workflwoId = doc.lockID.replace('workflow-','');
                            $scope.showRequestHistory = true;
                            _.extend($scope.document, doc);
                            if(doc.lockedBy.userID == $rootScope.user.userID)
                                $scope.canRecall = true;
                        }
                });

                // var documentNotificationsQuery = {
                //     $and : [{"data.documentInfo.identifier": $scope.document.identifier}]
                // };
                // IUserNotifications.query(documentNotificationsQuery, 0, 100)
                //     .then(function(data) {
                //         if (!data || data.length === 0)
                //             return;
                //         $scope.documentNotifications = data;
                //     });
            }
            $scope.refreshworkflowRecord = function(document, workflowInfo) {

               if (workflowInfo.workflowId) {
                   IWorkflows.get(workflowInfo.workflowId).then(function(data) {
                       if (data.state == 'completed') {
                           // var currentDocument = _.first(_.filter($scope.records, function(doc) {
                           //     return doc.identifier == document.header.identifier;
                           // }));
                           $scope.showRequestHistory = false;
                       } else {
                           $timeout(function() {
                               $scope.refreshworkflowRecord(document, workflowInfo);
                           }, 2000);
                       }
                   });
               }
{'fraction_non_alphanumeric': 0.13921208409879568, 'fraction_numerical': 0.0032659726474790775, 'mean_word_length': 1.4860476915271437, 'pattern_counts': {'":': 2, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4727179', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1213, 'n_words': 183}