<commit_before>angular.module('kassa').controller('UserNewCtrl', [
  '$scope'
  '$location'
  'UserService'
  ($scope, $location, User)->
    STATE_FAILED = 0
    STATE_SAVING = 1
    STATE_DEFAULT = 2

    cancel = ->
      $scope.user = {}
      $scope.newUserForm.$setPristine()

    save = (user)->
      goToUserProfile = (user)->
        $location.path("/users/#{user.id}")
      saveFailure = -> $scope.state = STATE_FAILED

      $scope.state = STATE_SAVING
      User.create(user).then(goToUserProfile, saveFailure)

    setBalance = (user, euros=0, cents=0)-> user.balance = euros + cents / 100

    passwordsMatch = (password, confirmation)-> password == confirmation

    $scope.cancel = cancel
    $scope.save = save
    $scope.setBalance = setBalance
    $scope.passwordsMatch = passwordsMatch

    $scope.FAILED = STATE_FAILED
    $scope.SAVING = STATE_SAVING
    $scope.DEFAULT = STATE_DEFAULT

    $scope.user = {}
])<commit_msg>Default new users as active<commit_after>angular.module('kassa').controller('UserNewCtrl', [
  '$scope'
  '$location'
  'UserService'
  ($scope, $location, User)->
    STATE_FAILED = 0
    STATE_SAVING = 1
    STATE_DEFAULT = 2

    newUser = -> {active: true}

    cancel = ->
      $scope.user = newUser()
      $scope.newUserForm.$setPristine()

    save = (user)->
      goToUserProfile = (user)->
        $location.path("/users/#{user.id}")
      saveFailure = -> $scope.state = STATE_FAILED

      $scope.state = STATE_SAVING
      User.create(user).then(goToUserProfile, saveFailure)

    setBalance = (user, euros=0, cents=0)-> user.balance = euros + cents / 100

    passwordsMatch = (password, confirmation)-> password == confirmation

    $scope.cancel = cancel
    $scope.save = save
    $scope.setBalance = setBalance
    $scope.passwordsMatch = passwordsMatch

    $scope.FAILED = STATE_FAILED
    $scope.SAVING = STATE_SAVING
    $scope.DEFAULT = STATE_DEFAULT

    $scope.user = newUser()
])
{'fraction_non_alphanumeric': 0.1402969790066564, 'fraction_numerical': 0.00819252432155658, 'mean_word_length': 3.0205761316872426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '6742140', 'n_tokens_mistral': 659, 'n_tokens_neox': 621, 'n_words': 121}