<commit_before>class LinkGroup extends KDCustomHTMLView

  constructor:(options = {}, data)->

    options.tagName         = 'div'
    options.cssClass        = 'link-group'
    options.itemClass     or= ProfileLinkView
    options.itemOptions   or= {}
    options.itemsToShow   or= 3
    options.totalCount    or= data?.length or options.group?.length or 0
    options.hasMore         = options.totalCount > options.itemsToShow
    options.separator      ?= ', '
    options.suffix        or= ''

    super options, data

    if data?
      @createParticipantSubviews()
    else if options.group
      @loadFromOrigins options.group

  loadFromOrigins:(group)->

    callback = (data)=>
      @setData data
      @createParticipantSubviews()
      @render()

    if group[0]?.constructorName
      lastFour = group.slice -4
      KD.remote.cacheable lastFour, (err, bucketContents)=>
        callback bucketContents
    else
      callback group

  createParticipantSubviews:->
    {itemClass, itemOptions} = @getOptions()
    participants = @getData()
    for participant, index in participants when participant
      if participant?.bongo_.constructorName is "ObjectRef"
        itemOptions.origin = participant
        @["participant#{index}"] = new itemClass itemOptions
      else
        @["participant#{index}"] = new itemClass itemOptions, participant
    # tmp fix
    return unless @participant0<commit_msg>activity: error handling on linkgroups<commit_after>class LinkGroup extends KDCustomHTMLView

  constructor:(options = {}, data)->

    options.tagName         = 'div'
    options.cssClass        = 'link-group'
    options.itemClass     or= ProfileLinkView
    options.itemOptions   or= {}
    options.itemsToShow   or= 3
    options.totalCount    or= data?.length or options.group?.length or 0
    options.hasMore         = options.totalCount > options.itemsToShow
    options.separator      ?= ', '
    options.suffix        or= ''

    super options, data

    if @getData()
      @createParticipantSubviews()
    else if options.group
      @loadFromOrigins options.group

  loadFromOrigins:(group)->

    callback = (data)=>
      @setData data
      @createParticipantSubviews()
      @render()

    if group[0]?.constructorName
      lastFour = group.slice -4
      KD.remote.cacheable lastFour, (err, bucketContents)=>
        if err
        then warn err
        else callback bucketContents
    else
      callback group

  createParticipantSubviews:->
    {itemClass, itemOptions} = @getOptions()
    participants = @getData()

    # unless participants
    #   debugger
    #   return

    for participant, index in participants when participant
      if participant?.bongo_.constructorName is "ObjectRef"
        itemOptions.origin = participant
        @["participant#{index}"] = new itemClass itemOptions
      else
        @["participant#{index}"] = new itemClass itemOptions, participant
    # tmp fix
    return unless @participant0
{'fraction_non_alphanumeric': 0.09231805929919137, 'fraction_numerical': 0.0033692722371967657, 'mean_word_length': 2.701995012468828, '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': '5392912', 'n_tokens_mistral': 840, 'n_tokens_neox': 800, 'n_words': 207}