<commit_before>'use strict';

angular
  .module('mapProjectApp.widgets.mapEntry', [ 'adf.provider' ])
  .config(function(dashboardProvider) {
    dashboardProvider.widget('mapEntry', {
      title : 'Map Entry',
      description : 'Edit module for a map entry',
      controller : 'mapEntryWidgetCtrl',
      templateUrl : 'js/widgets/mapEntry/mapEntry.html',
      edit : {}
    });
  })
  .controller(
    'mapEntryWidgetCtrl',
    [
      '$scope',
      '$window',
      '$rootScope',
      '$q',
      '$http',
      '$routeParams',
      '$uibModal',
      '$location',
      '$anchorScroll',
      'localStorageService',
      function($scope, $window, $rootScope, $q, $http, $routeParams, $uibModal,
        $location, $anchorScroll, localStorageService) {

        // for this widget, the only local storage service variable used is
        // user
        // token
        $scope.userToken = localStorageService.get('userToken');

        // watch for entry change
        $scope.$on('mapRecordWidget.notification.changeSelectedEntry',
          function(event, parameters) {
            console.debug(
              '  => on mapRecordWidget.notification.changeSelectedEntry = ',
              parameters.record, parameters.entry);
            $scope.entry = parameters.entry;
            $scope.record = parameters.record;
            $scope.project = parameters.project;

            // get the allowable advices
            $scope.allowableAdvices = getAllowableAdvices(parameters.entry,
              parameters.project.mapAdvice);
            sortByKey($scope.allowableAdvices, 'detail');
            $scope.allowableMapRelations = getAllowableRelations(
              parameters.entry, parameters.project.mapRelation);

            // set the rule to null if a non-rule-based project
            // added to catch any badly constructed rules from other widgets
            if (!$scope.project.ruleBased) {
              $scope.entry.rule = null;
            }

            // compute relation and advice IFF a target or entry has
            // been set attempt to autocompute the map relation, then update the
            // entry
            $scope.computeParameters(false);

          });

        //
        $scope.$on('mapRecordWidget.notification.recordChanged', <commit_msg>undo/redo fix: removed computeParameters on changeSelectedEntry - was breaking seeing the correct advices, and no need to recompute when just navigating around the UI.<commit_after>'use strict';

angular
  .module('mapProjectApp.widgets.mapEntry', [ 'adf.provider' ])
  .config(function(dashboardProvider) {
    dashboardProvider.widget('mapEntry', {
      title : 'Map Entry',
      description : 'Edit module for a map entry',
      controller : 'mapEntryWidgetCtrl',
      templateUrl : 'js/widgets/mapEntry/mapEntry.html',
      edit : {}
    });
  })
  .controller(
    'mapEntryWidgetCtrl',
    [
      '$scope',
      '$window',
      '$rootScope',
      '$q',
      '$http',
      '$routeParams',
      '$uibModal',
      '$location',
      '$anchorScroll',
      'localStorageService',
      function($scope, $window, $rootScope, $q, $http, $routeParams, $uibModal,
        $location, $anchorScroll, localStorageService) {

        // for this widget, the only local storage service variable used is
        // user
        // token
        $scope.userToken = localStorageService.get('userToken');

        // watch for entry change
        $scope.$on('mapRecordWidget.notification.changeSelectedEntry',
          function(event, parameters) {
            console.debug(
              '  => on mapRecordWidget.notification.changeSelectedEntry = ',
              parameters.record, parameters.entry);
            $scope.entry = parameters.entry;
            $scope.record = parameters.record;
            $scope.project = parameters.project;

            // get the allowable advices
            $scope.allowableAdvices = getAllowableAdvices(parameters.entry,
              parameters.project.mapAdvice);
            sortByKey($scope.allowableAdvices, 'detail');
            $scope.allowableMapRelations = getAllowableRelations(
              parameters.entry, parameters.project.mapRelation);

            // set the rule to null if a non-rule-based project
            // added to catch any badly constructed rules from other widgets
            if (!$scope.project.ruleBased) {
              $scope.entry.rule = null;
            }

            // compute relation and advice IFF a target or entry has
            // been set attempt to autocompute the map relation, then update the
            // entry
            // $scope.computeParameters(false);

          });

        //
        $scope.$on('mapRecordWidget.notification.recordChanged', 
{'fraction_non_alphanumeric': 0.11087734062697244, 'fraction_numerical': 0.0, 'mean_word_length': 2.1991924629878867, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6340662', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1199, 'n_words': 296}