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

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

  SpotTabController.$inject = ['$cordovaGeolocation', '$ionicModal', '$ionicPopup', '$log', '$scope', '$state',
    'FormFactory', 'HelpersFactory', 'LiveDBFactory', 'ProjectFactory', 'SpotFactory', 'IS_WEB'];

  function SpotTabController($cordovaGeolocation, $ionicModal, $ionicPopup, $log, $scope, $state, FormFactory,
                             HelpersFactory, LiveDBFactory, ProjectFactory, SpotFactory, IS_WEB) {
    var vm = this;
    var vmParent = $scope.vm;

    var thisTabName = 'spot';

    vm.isCreateGeologicUnitTag = false;
    vm.isSelectGeologicUnitTag = false;
    vm.lat = undefined;
    vm.lng = undefined;
    vm.x = undefined;
    vm.y = undefined;

    vm.addGeologicUnitTag = addGeologicUnitTag;
    vm.closeGeologicUnitTagModal = closeGeologicUnitTagModal;
    vm.createGeologicUnitTag = createGeologicUnitTag;
    vm.getCoordArray = getCoordArray;
    vm.isImageBasemapSpot = isImageBasemapSpot;
    vm.isMapped = isMapped;
    vm.isPixelMapping = isPixelMapping;
    vm.isPointSpot = isPointSpot;
    vm.isStratSectionSpot= isStratSectionSpot;
    vm.setCurrentLocation = setCurrentLocation;
    vm.setFromMap = setFromMap;
    vm.updateDatetime = updateDatetime;
    vm.updateLatitude = updateLatitude;
    vm.updateLongitude = updateLongitude;
    vm.updateX = updateX;
    vm.updateY = updateY;

    activate();

    /**
     * Private Functions
     */

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

      // 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}
            });
          });
        }
      });

      $ionicModal.fromTemplateUrl('app/spot/spot-tab/add-geologic-unit-tag-modal.html', {
        'scope': $scope,
        'animation': 'slide-in-up',
        'backdropClickToClose': false
      }).then(function (modal) {
        vmParent.addGeologicUnitTagModal = modal;
      });

      $scope.$on('update-spot-geometry', function (event, args) {
        vmParent.spot.geometry = args.movedSpotGeometry;
        vmParent.initializing = true;
        setDisplayedCoords();
      });
    }

    // Get current location of the user
    function getCurrentLocation() {
      $cordovaGeolocation.getCurrentPosition().then(function (position) {
        vm.lat = position.coords.latitude;
        vm.lng = position.coords.longitude;
        if (isPixelMapping()) {
          vmParent.spot.properties.lng = vm.lng;<commit_msg>reverting changes to getCurrentLocation ()<commit_after>(function () {
  'use strict';

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

  SpotTabController.$inject = ['$cordovaGeolocation', '$ionicModal', '$ionicPopup', '$log', '$scope', '$state',
    'FormFactory', 'HelpersFactory', 'LiveDBFactory', 'ProjectFactory', 'SpotFactory', 'IS_WEB'];

  function SpotTabController($cordovaGeolocation, $ionicModal, $ionicPopup, $log, $scope, $state, FormFactory,
                             HelpersFactory, LiveDBFactory, ProjectFactory, SpotFactory, IS_WEB) {
    var vm = this;
    var vmParent = $scope.vm;

    var thisTabName = 'spot';

    vm.isCreateGeologicUnitTag = false;
    vm.isSelectGeologicUnitTag = false;
    vm.lat = undefined;
    vm.lng = undefined;
    vm.x = undefined;
    vm.y = undefined;

    vm.addGeologicUnitTag = addGeologicUnitTag;
    vm.closeGeologicUnitTagModal = closeGeologicUnitTagModal;
    vm.createGeologicUnitTag = createGeologicUnitTag;
    vm.getCoordArray = getCoordArray;
    vm.isImageBasemapSpot = isImageBasemapSpot;
    vm.isMapped = isMapped;
    vm.isPixelMapping = isPixelMapping;
    vm.isPointSpot = isPointSpot;
    vm.isStratSectionSpot= isStratSectionSpot;
    vm.setCurrentLocation = setCurrentLocation;
    vm.setFromMap = setFromMap;
    vm.updateDatetime = updateDatetime;
    vm.updateLatitude = updateLatitude;
    vm.updateLongitude = updateLongitude;
    vm.updateX = updateX;
    vm.updateY = updateY;

    activate();

    /**
     * Private Functions
     */

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

      // 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}
            });
          });
        }
      });

      $ionicModal.fromTemplateUrl('app/spot/spot-tab/add-geologic-unit-tag-modal.html', {
        'scope': $scope,
        'animation': 'slide-in-up',
        'backdropClickToClose': false
      }).then(function (modal) {
        vmParent.addGeologicUnitTagModal = modal;
      });

      $scope.$on('update-spot-geometry', function (event, args) {
        vmParent.spot.geometry = args.movedSpotGeometry;
        vmParent.initializing = true;
        setDisplayedCoords();
      });
    }

    // Get current location of the user
    function getCurrentLocation() {
      $cordovaGeolocation.getCurrentPosition().then(function (position) {
        vm.lat = HelpersFactory.roundToDecimalPlaces(position.coords.latitude, 6);
        vm.lng = HelpersFactory.roundToDecimalPlaces(position.coords.longitude, 6);
        if (isPixelMapping()) {
          vmParent.spot.properties.lng = vm.lng;
{'fraction_non_alphanumeric': 0.12773053193263298, 'fraction_numerical': 0.00033350008337502084, 'mean_word_length': 2.892277741726152, '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': '924443', 'n_tokens_mistral': 1877, 'n_tokens_neox': 1800, 'n_words': 335}