<commit_before>'use strict';

angular.module('emission.main.goals',['emission.services', 'emission.plugin.logger',
                'ngSanitize', 'ngAnimate',
                'emission.splash.referral', 'angularLocalStorage',
                'ng-walkthrough', 'nzTour'])

.controller('GoalsCtrl', function(CommHelper, $state, $ionicLoading, $scope, $rootScope, $ionicModal, nzTour,
                                $window, $http, $ionicGesture, $ionicPopup, $timeout, storage, ReferralHandler, ReferHelper, Logger, $cordovaInAppBrowser){
    $scope.goals = [];
    $scope.goal = {};
    $scope.challenges=[];
    var partyId;
    var userId;
    $scope.joinedChallenges = [];
    $scope.plusInProcess = {};
    $scope.minusInProcess = {};
    var prepopulateMessage = {};
    var floatHp;
    var floatGold;
    var refresh;
    var HABITICA_REGISTERED_KEY = 'habitica_registered';
    //var challengeMembersId = [];

    $rootScope.$on("RELOAD_GOAL_PAGE_FOR_REFERRAL", function(event) {
      Logger.log("Received referral event, current state is "+$state.$current.name);
      if ($state.$current.name == 'root.main.goals') {
        refreshInfo();
      }
    });

    $ionicModal.fromTemplateUrl('templates/goals/goal-modal.html', {
        scope: $scope,
        animation: 'slide-in-up'
    }).then(function(modal) {
        $scope.modal = modal;
    });

    $ionicModal.fromTemplateUrl('templates/goals/party-members.html', {
        scope: $scope,
        animation: 'slide-in-up'
    }).then(function(modal) {
        $scope.partyModal = modal;
    });

    $ionicModal.fromTemplateUrl('templates/goals/leaderboard-modal.html', {
        scope: $scope,
        animation: 'slide-in-up'
    }).then(function(modal) {
        $scope.leaderboardModal = modal;
    });

    $ionicModal.fromTemplateUrl('templates/goals/browser.html', {
        scope: $scope,
        animation: 'slide-in-up'
    }).then(function(modal) {
        $scope.browserModal = modal;
    });

    var joinGroupSuccess = function() {
       refreshInfo();
       var alertPopup = $ionicPopup.alert({
         title: 'Cool!',
         template: 'You have successfully joined the group!'
       });

       alertPopup.then(function(res) {
       });
    };

    var joinGroupFail = function(error) {
       var displayMsg = error;
       if (error.indexOf("Code=400") != -1) {
          displayMsg = "You are already part of a group! If you want to accept "+
           "this invite, please leave this group using the website and then "+
           "click on this link again to join"<commit_msg>iad done<commit_after>'use strict';

angular.module('emission.main.goals',['emission.services', 'emission.plugin.logger',
                'ngSanitize', 'ngAnimate',
                'emission.splash.referral', 'angularLocalStorage',
                'ng-walkthrough', 'nzTour'])

.controller('GoalsCtrl', function(CommHelper, $state, $ionicLoading, $scope, $rootScope, $ionicModal, nzTour,
                                $window, $http, $ionicGesture, $ionicPopup, $timeout, storage, ReferralHandler, ReferHelper, Logger, $cordovaInAppBrowser){
    $scope.goals = [];
    $scope.goal = {};
    $scope.challenges=[];
    var partyId;
    var userId;
    $scope.joinedChallenges = [];
    $scope.plusInProcess = {};
    $scope.minusInProcess = {};
    var prepopulateMessage = {};
    var floatHp;
    var floatGold;
    var refresh;
    var HABITICA_REGISTERED_KEY = 'habitica_registered';
    //var challengeMembersId = [];

    $rootScope.$on("RELOAD_GOAL_PAGE_FOR_REFERRAL", function(event) {
      Logger.log("Received referral event, current state is "+$state.$current.name);
      if ($state.$current.name == 'root.main.goals') {
        refreshInfo();
      }
    });

    $ionicModal.fromTemplateUrl('templates/goals/goal-modal.html', {
        scope: $scope,
        animation: 'slide-in-up'
    }).then(function(modal) {
        $scope.modal = modal;
    });

    $ionicModal.fromTemplateUrl('templates/goals/party-members.html', {
        scope: $scope,
        animation: 'slide-in-up'
    }).then(function(modal) {
        $scope.partyModal = modal;
    });

    $ionicModal.fromTemplateUrl('templates/goals/leaderboard-modal.html', {
        scope: $scope,
        animation: 'slide-in-up'
    }).then(function(modal) {
        $scope.leaderboardModal = modal;
    });


    var joinGroupSuccess = function() {
       refreshInfo();
       var alertPopup = $ionicPopup.alert({
         title: 'Cool!',
         template: 'You have successfully joined the group!'
       });

       alertPopup.then(function(res) {
       });
    };

    var joinGroupFail = function(error) {
       var displayMsg = error;
       if (error.indexOf("Code=400") != -1) {
          displayMsg = "You are already part of a group! If you want to accept "+
           "this invite, please leave this group using the website and then "+
           "click on this link again to join"
{'fraction_non_alphanumeric': 0.14366653176851477, 'fraction_numerical': 0.0016187778227438284, 'mean_word_length': 2.6560650887573964, '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': '3343069', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1471, 'n_words': 298}