app/models/record_revision.rb
# ====Params
# String, name of provider
# ====Returns
# List of record lists, each sub list is all records for a collection in order of ingest
# ==== Method
# Grabs all records, then maps them to the sublists based on collection id
# Sorts the sublists based on record id with the assumption that newer revisions are ingested after older ones.
# Do not want to rely on revision ids since they may not be numbers
Params
String, name of provider
Returns
List of record lists, each sub list is all records for a collection in order of ingest
Method
Grabs all records, then maps them to the sublists based on collection id
Sorts the sublists based on record id with the assumption that newer revisions are ingested after older ones.
Do not want to rely on revision ids since they may not be numbers
Params String name of provider Returns List of record lists each sub list is all records for a collection in order of ingest Method Grabs all records then maps them to the sublists based on collection id Sorts the sublists based on record id with the assumption that newer revisions are ingested after older ones . Do not want to rely on revision ids since they may not be numbers
def ordered_revisions(daac_short_name = nil, application_mode = :arc_mode)
    collection_records = all_records(application_mode).where(state: MetricData::METRIC_STATES)
    collection_records = collection_records.daac(daac_short_name) if daac_short_name
    records_hash = {}
    collection_records.each do |record|
      if records_hash.key?(record.recordable_id)
        records_hash[record.recordable_id].push(record)
      else
        records_hash[record.recordable_id] = [record]
      end
    end
    records_hash.each do |key, list|
      records_hash[key] = list.sort { |x,y| y.id.to_i <=> x.id.to_i }
    end
    records_hash
  end
def ordered_revisions ( daac_short_name = nil , application_mode = :arc_mode ) collection_records = all_records ( application_mode ) . where ( state : MetricData :: METRIC_STATES ) collection_records = collection_records . daac ( daac_short_name ) if daac_short_name records_hash = { } collection_records . each do | record | if records_hash . key? ( record . recordable_id ) records_hash [ record . recordable_id ] . push ( record ) else records_hash [ record . recordable_id ] = [ record ] end end records_hash . each do | key , list | records_hash [ key ] = list . sort { | x , y | y . id . to_i <=> x . id . to_i } end records_hash end
Params
String, name of provider
Returns
List of record lists, each sub list is all records for a collection in order of ingest
 Method
Grabs all records, then maps them to the sublists based on collection id
Sorts the sublists based on record id with the assumption that newer revisions are ingested after older ones.
Params String name of provider Returns List of record lists each sub list is all records for a collection in order of ingest Method Grabs all records then maps them to the sublists based on collection id Sorts the sublists based on record id with the assumption that newer revisions are ingested after older ones .
daac_short_name
<not_specific>
application_mode
<not_specific>