<commit_before>angular.module("doubtfire.services.group-service", [  ])

.factory("groupService", () ->
  #
  # The unit service object
  #
  groupService = {}

  # gets the sum of contributions assuming that member has value rather than their current rating
  groupService.groupContributionSum = (members, member, value) ->
    _.reduce members,
      (memo, mbr) ->
        if member == mbr
          memo + value
        else
          memo + mbr.rating
      0

  groupService.isGroupTask = (task) ->
    task.definition.group_set?

  groupService.groupSetName = (id, unit) ->
    gs = _.find(unit.group_sets, (gs) -> gs.id is id)
    if gs then gs.name else "Individual Work"

  groupService
)<commit_msg>fix searching for group set by id<commit_after>angular.module("doubtfire.services.group-service", [  ])

.factory("groupService", () ->
  #
  # The unit service object
  #
  groupService = {}

  # gets the sum of contributions assuming that member has value rather than their current rating
  groupService.groupContributionSum = (members, member, value) ->
    _.reduce members,
      (memo, mbr) ->
        if member == mbr
          memo + value
        else
          memo + mbr.rating
      0

  groupService.isGroupTask = (task) ->
    task.definition.group_set?

  groupService.groupSetName = (id, unit) ->
    gs = _.find(unit.group_sets, (gs) -> gs.id is parseInt(id))
    if gs then gs.name else "Individual Work"

  groupService
)
{'fraction_non_alphanumeric': 0.11310344827586206, 'fraction_numerical': 0.001379310344827586, 'mean_word_length': 2.730077120822622, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4906031', 'n_tokens_mistral': 455, 'n_tokens_neox': 442, 'n_words': 124}