<commit_before>(function () {
  'use strict';

  angular
    .module('app')
    .controller('SedStructuresTabController', SedStructuresTabController);

  SedStructuresTabController.$inject = ['$ionicModal', '$ionicPopup', '$log', '$scope', '$state', 'FormFactory'];

  function SedStructuresTabController($ionicModal, $ionicPopup, $log, $scope, $state, FormFactory) {
    var vm = this;
    var vmParent = $scope.vm;

    var thisTabName = 'sed-structures';

    vm.switchForm = switchForm;

    activate();

    /**
     * Private Functions
     */

    function activate() {
      $log.log('In SedStructuresTabController');

      // Loading tab from Spots list
      if ($state.current.name === 'app.spotTab.' + thisTabName) loadTab($state);
      // Loading tab in Map side panel
      $scope.$on('load-tab', function (event, args) {
        if (args.tabName === thisTabName) {
          vmParent.saveSpot().finally(function () {
            vmParent.spotChanged = false;
            loadTab({
              'current': {'name': 'app.spotTab.' + thisTabName},
              'params': {'spotId': args.spotId}
            });
          });
        }
      });
    }

    function loadTab(state) {
      vmParent.loadTab(state);     // Need to load current state into parent
      FormFactory.setForm('sed', 'physical_structures');
      if (vmParent.spot.properties.sed && vmParent.spot.properties.sed.structures) {
        $log.log('Sed Structures:', vmParent.spot.properties.sed.structures);
        vmParent.data = vmParent.spot.properties.sed.structures;
      }
      else vmParent.data = {};
    }

    /**
     * Public Functions
     */

    function switchForm(form) {
      FormFactory.setForm('sed', form);
    }

  }
}());<commit_msg>sed - propagate structures from basics to physical structures<commit_after>(function () {
  'use strict';

  angular
    .module('app')
    .controller('SedStructuresTabController', SedStructuresTabController);

  SedStructuresTabController.$inject = ['$ionicModal', '$ionicPopup', '$log', '$scope', '$state', 'FormFactory'];

  function SedStructuresTabController($ionicModal, $ionicPopup, $log, $scope, $state, FormFactory) {
    var vm = this;
    var vmParent = $scope.vm;

    var thisTabName = 'sed-structures';

    vm.switchForm = switchForm;

    activate();

    /**
     * Private Functions
     */

    function activate() {
      $log.log('In SedStructuresTabController');

      // Loading tab from Spots list
      if ($state.current.name === 'app.spotTab.' + thisTabName) loadTab($state);
      // Loading tab in Map side panel
      $scope.$on('load-tab', function (event, args) {
        if (args.tabName === thisTabName) {
          vmParent.saveSpot().finally(function () {
            vmParent.spotChanged = false;
            loadTab({
              'current': {'name': 'app.spotTab.' + thisTabName},
              'params': {'spotId': args.spotId}
            });
          });
        }
      });
    }

    function getStructuresFromLithologies() {
      if (vmParent.spot.properties.sed && vmParent.spot.properties.sed.lithologies) {
        if (vmParent.spot.properties.sed.lithologies.mud_silt_prin_struct) {
          if (!vmParent.spot.properties.sed.structures) vmParent.spot.properties.sed.structures = {};
          vmParent.spot.properties.sed.structures.mudstone_structures = true;
          vmParent.spot.properties.sed.structures.mud_silt_prin_struct = vmParent.spot.properties.sed.lithologies.mud_silt_prin_struct;
        }
        if (vmParent.spot.properties.sed.lithologies.sandstone_prin_struct) {
          if (!vmParent.spot.properties.sed.structures) vmParent.spot.properties.sed.structures = {};
          vmParent.spot.properties.sed.structures.sandstone_structures = true;
          vmParent.spot.properties.sed.structures.sandstone_prin_struct = vmParent.spot.properties.sed.lithologies.sandstone_prin_struct;
        }
        if (vmParent.spot.properties.sed.lithologies.congl_breccia_prin_struct) {
          if (!vmParent.spot.properties.sed.structures) vmParent.spot.properties.sed.structures = {};
          vmParent.spot.properties.sed.structures.conglomerate_structures = true;
          vmParent.spot.properties.sed.structures.congl_breccia_prin_struct = vmParent.spot.properties.sed.lithologies.congl_breccia_prin_struct;
        }
        if (vmParent.spot.properties.sed.lithologies.limestone_dolomite_prin_struct) {
          if (!vmParent.spot.properties.sed.structures) vmParent.spot.properties.sed.structures = {};
          vmParent.spot.properties.sed.structures.limestone_structures = true;
          vmParent.spot.properties.sed.structures.limestone_dolomite_prin_struct = vmParent.spot.properties.sed.lithologies.limestone_dolomite_prin_struct;
        }
      }
    }

    function loadTab(state) {
      vmParent.loadTab(state);     // Need to load current state into parent
      FormFactory.setForm('sed', 'physical_structures');
      getStructuresFromLithologies();
      if (vmParent.spot.properties.sed && vmParent.spot.properties.sed.structures) {
        $log.log('Sed Structures:', vmParent.spot.properties.sed.structures);
        vmParent.data = vmParent.spot.properties.sed.structures;
      }
      else vmParent.data = {};
    }

    /**
     * Public Functions
     */

    function switchForm(form) {
      FormFactory.setForm('sed', form);
    }

  }
}());
{'fraction_non_alphanumeric': 0.1333209716298906, 'fraction_numerical': 0.0, 'mean_word_length': 2.877785765636233, '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': '3519035', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1576, 'n_words': 251}