<commit_before>_ = require('lodash')

module.exports = ($scope, AuthService, AllocationModel, AllocationsStore, group, round, memberships) ->
  contributors = round.getContributors(memberships)
  allocations = round.getAllocationsByUser()

  $scope.isAdmin = group.isAdmin(AuthService.getCurrentUser())

  $scope.contributors = _.filter contributors, (contributor) ->
    # non-admins shouldn't see contributors with no allocations
    $scope.isAdmin or contributor.allocationCents != 0

  $scope.updateAllocation = (contributor, data) ->
    allocation = allocations[contributor.user.id]

    if allocation
      allocation.amountCents = data * 100
    else
      allocation = new AllocationModel(
        user: contributor.user.serialize()<commit_msg>fix creating new allocation in round contributors controller to be based on previous changes to allocation model<commit_after>_ = require('lodash')

module.exports = ($scope, AuthService, AllocationModel, AllocationsStore, group, round, memberships) ->
  contributors = round.getContributors(memberships)
  allocations = round.getAllocationsByUser()

  $scope.isAdmin = group.isAdmin(AuthService.getCurrentUser())

  $scope.contributors = _.filter contributors, (contributor) ->
    # non-admins shouldn't see contributors with no allocations
    $scope.isAdmin or contributor.allocationCents != 0

  $scope.updateAllocation = (contributor, data) ->
    allocation = allocations[contributor.user.id]

    if allocation
      allocation.amountCents = data * 100
    else
      allocation = new AllocationModel(
        user_id: contributor.user.id
{'fraction_non_alphanumeric': 0.09631019387116949, 'fraction_numerical': 0.0050031269543464665, 'mean_word_length': 4.498281786941581, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1117807', 'n_tokens_mistral': 460, 'n_tokens_neox': 433, 'n_words': 109}