Method: Alma::Electronic::BatchUtils#build_notes

Defined in:
lib/alma/electronic/batch_utils.rb

#build_notes(options = {}) ⇒ Object

Builds the notes object using the logs.



129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/alma/electronic/batch_utils.rb', line 129

def build_notes(options = {})
  options ||= {}
  type ||= options.fetch(:type, "collection")

  get_logged_items(options)
    .select { |item| item.slice("authentication_note", "public_note").values.any?(&:present?) }
    .inject({}) do |nodes, item|

    id = item["#{type}_id"]
    nodes.merge(id => item.slice("authentication_note", "public_note"))
  end
end