<commit_before>class window.NDPEvidenceCollection extends Backbone.Factlink.Collection

  initialize: (models, options) ->
    @fact = options.fact

    @_supportingCollection = new OneSidedEvidenceCollection null, fact: @fact, type: 'supporting'
    @_weakeningCollection = new OneSidedEvidenceCollection null, fact: @fact, type: 'weakening'

    @_containedCollections = [
      new OpinionatersCollection null, fact: @fact
      @_supportingCollection
      @_weakeningCollection
    ]

    for collection in @_containedCollections
      collection.on 'sync', @loadFromCollections, @

  comparator: (item) -> - item.get('impact')

  loading: ->
    _.some @_containedCollections, (collection) -> collection.loading()

  fetch: (options={}) ->
    @trigger 'request', this
    _.invoke @_containedCollections, 'fetch', options

  loadFromCollections: (collectionOrModel) ->
    return if @loading()
    return unless collectionOrModel in @_containedCollections # collection proxies model's sync

    @reset(_.union (col.models for col in @_containedCollections)...)
    @trigger 'sync'

  oneSidedEvidenceCollection: (type) ->
    switch type
      when 'supporting' then @_supportingCollection
      when 'weakening' then @_weakeningCollection
      else throw 'Unknown OneSidedEvidenceCollection type'
<commit_msg>Adding should propagate to NDPEvidenceCollection<commit_after>class window.NDPEvidenceCollection extends Backbone.Factlink.Collection

  initialize: (models, options) ->
    @fact = options.fact

    @_supportingCollection = new OneSidedEvidenceCollection null, fact: @fact, type: 'supporting'
    @_weakeningCollection = new OneSidedEvidenceCollection null, fact: @fact, type: 'weakening'

    @_containedCollections = [
      new OpinionatersCollection null, fact: @fact
      @_supportingCollection
      @_weakeningCollection
    ]

    for collection in @_containedCollections
      @listenTo collection, 'sync', @onCollectionSync
      @listenTo collection, 'add', @loadFromCollections

  comparator: (item) -> - item.get('impact')

  loading: ->
    _.some @_containedCollections, (collection) -> collection.loading()

  fetch: (options={}) ->
    @trigger 'request', this
    _.invoke @_containedCollections, 'fetch', _.extend {}, options, reset: true

  onCollectionSync: (collectionOrModel) ->
    return unless collectionOrModel in @_containedCollections # collection proxies model's sync
    @loadFromCollections()

  loadFromCollections: ->
    return if @loading()

    @reset(_.union (col.models for col in @_containedCollections)...)
    @trigger 'sync'

  oneSidedEvidenceCollection: (type) ->
    switch type
      when 'supporting' then @_supportingCollection
      when 'weakening' then @_weakeningCollection
      else throw 'Unknown OneSidedEvidenceCollection type'

{'fraction_non_alphanumeric': 0.09871703492516037, 'fraction_numerical': 0.0, 'mean_word_length': 4.217472118959108, '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': '935271', 'n_tokens_mistral': 798, 'n_tokens_neox': 745, 'n_words': 206}