<commit_before>module.exports =
  resolve:
    userValidated: ($auth) ->
      $auth.validateUser()
    membershipsLoaded: ->
      global.cobudgetApp.membershipsLoaded
  url: '/groups/:groupId/manage_funds'
  template: require('./manage-group-funds-page.html')
  controller: (CurrentUser, Error, LoadBar, Records, $scope, $stateParams, UserCan) ->

    LoadBar.start()
    groupId = parseInt($stateParams.groupId)
    Records.groups.findOrFetchById(groupId)
      .then (group) ->
        LoadBar.stop()
        if UserCan.manageFundsForGroup(group)
          $scope.authorized = true
          Error.clear()
          $scope.group = group
          $scope.currentUser = CurrentUser()
          Records.memberships.fetchByGroupId(groupId)
        else
          $scope.authorized = false
          Error.set("you can't view this page")
      .catch ->
        LoadBar.stop()
        Error.set('group not found')

    $scope.csvData = ->
      _.map Records.memberships.collection.data, (membership) ->
        [membership.member().email, membership.rawBalance]

    $scope.csvFileName = ->
      timestamp = moment().format('YYYY-MM-DD-HH-mm-ss')
      "#{$scope.group.name}-member-data-#{timestamp}"

    return<commit_msg>only return memberships for group<commit_after>module.exports =
  resolve:
    userValidated: ($auth) ->
      $auth.validateUser()
    membershipsLoaded: ->
      global.cobudgetApp.membershipsLoaded
  url: '/groups/:groupId/manage_funds'
  template: require('./manage-group-funds-page.html')
  controller: (CurrentUser, Error, LoadBar, Records, $scope, $stateParams, UserCan) ->

    LoadBar.start()
    groupId = parseInt($stateParams.groupId)
    Records.groups.findOrFetchById(groupId)
      .then (group) ->
        LoadBar.stop()
        if UserCan.manageFundsForGroup(group)
          $scope.authorized = true
          Error.clear()
          $scope.group = group
          $scope.currentUser = CurrentUser()
          Records.memberships.fetchByGroupId(groupId)
        else
          $scope.authorized = false
          Error.set("you can't view this page")
      .catch ->
        LoadBar.stop()
        Error.set('group not found')

    $scope.csvData = ->
      groupMemberships = _.filter Records.memberships.collection.data, (membership) ->
        membership.groupId == groupId
      _.map groupMemberships, (membership) ->
        [membership.member().email, membership.rawBalance]

    $scope.csvFileName = ->
      timestamp = moment().format('YYYY-MM-DD-HH-mm-ss')
      "#{$scope.group.name}-member-data-#{timestamp}"

    return
{'fraction_non_alphanumeric': 0.13354037267080746, 'fraction_numerical': 0.0, 'mean_word_length': 2.634696755994358, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '1891255', 'n_tokens_mistral': 780, 'n_tokens_neox': 751, 'n_words': 129}