app/models/harvest_event.rb
# TODO: this would be unnecessary if, during a harvest, we just looked for the
# previous harvest event's associations and honored those visibilities.
this would be unnecessary if, during a harvest, we just looked for the
previous harvest event's associations and honored those visibilities.
this would be unnecessary if during a harvest we just looked for the previous harvest event ' s associations and honored those visibilities .
def preserve_invisible
    previously = resource.latest_published_harvest_event_uncached
    if previously.nil?
      EOL.log("First harvest! skipping #preserve_invisible.")
      return
    end
    invisible_ids = DataObjectsHierarchyEntry.invisible.
      joins("JOIN data_objects_harvest_events ON "\
        "(data_objects_harvest_events.data_object_id = "\
        "data_objects_hierarchy_entries.data_object_id AND "\
        "data_objects_harvest_events.harvest_event_id = #{previously.id})").
      pluck(:data_object_id)
    DataObjectsHierarchyEntry.
      joins("JOIN data_objects_harvest_events ON "\
        "(data_objects_harvest_events.data_object_id = "\
        "data_objects_hierarchy_entries.data_object_id AND "\
        "data_objects_harvest_events.harvest_event_id = #{id})").
      where(data_object_id: invisible_ids).
      update_all(visibility_id: Visibility.get_invisible.id)
  end
def preserve_invisible previously = resource . latest_published_harvest_event_uncached if previously . nil? EOL . log ( "First harvest! skipping #preserve_invisible." ) return end invisible_ids = DataObjectsHierarchyEntry . invisible . joins ( "JOIN data_objects_harvest_events ON " "(data_objects_harvest_events.data_object_id = " "data_objects_hierarchy_entries.data_object_id AND " "data_objects_harvest_events.harvest_event_id = #{previously.id})" ) . pluck ( :data_object_id ) DataObjectsHierarchyEntry . joins ( "JOIN data_objects_harvest_events ON " "(data_objects_harvest_events.data_object_id = " "data_objects_hierarchy_entries.data_object_id AND " "data_objects_harvest_events.harvest_event_id = #{id})" ) . where ( data_object_id : invisible_ids ) . update_all ( visibility_id : Visibility . get_invisible . id ) end
TODO: this would be unnecessary if, during a harvest, we just looked for the
previous harvest event's associations and honored those visibilities.
TODO : this would be unnecessary if during a harvest we just looked for the previous harvest event ' s associations and honored those visibilities .
# NOTE: Ick. This actually runs moderately fast, but... ick. TODO - This # would be much simpler if we had the harvest_event_id in the dohe table... # or something like that...