Skip to content

Commit

Permalink
AR-1813 Favor using the Solr resolved top container information
Browse files Browse the repository at this point in the history
Otherwise we end up with full top container names in places we don't
want them.
  • Loading branch information
marktriggs committed Jun 19, 2017
1 parent 304c477 commit ee228b5
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions public-new/app/models/record.rb
Expand Up @@ -344,22 +344,20 @@ def parse_sub_container_display_string(sub_container, inst, opts = {})

# add the top container type and indicator
if sub_container.has_key?('top_container')
if sub_container['top_container']['_resolved'] && sub_container['top_container']['_resolved']['display_string']
# We have a resolved top container with a display string
parts << sub_container['top_container']['_resolved']['display_string']
else
top_container_solr = top_container_for_uri(sub_container['top_container']['ref'])
if top_container_solr
# We have a top container from Solr
top_container_solr = top_container_for_uri(sub_container['top_container']['ref'])
if top_container_solr
top_container_display_string = ""
top_container_json = ASUtils.json_parse(top_container_solr.fetch('json'))
if top_container_json['type']
top_container_type = I18n.t("enumerations.container_type.#{top_container_json.fetch('type')}", :default => top_container_json.fetch('type'))
top_container_display_string << "#{top_container_type}: "
end
top_container_display_string << top_container_json.fetch('indicator')
parts << top_container_display_string
top_container_display_string = ""
top_container_json = ASUtils.json_parse(top_container_solr.fetch('json'))
if top_container_json['type']
top_container_type = I18n.t("enumerations.container_type.#{top_container_json.fetch('type')}", :default => top_container_json.fetch('type'))
top_container_display_string << "#{top_container_type}: "
end
top_container_display_string << top_container_json.fetch('indicator')
parts << top_container_display_string
elsif sub_container['top_container']['_resolved'] && sub_container['top_container']['_resolved']['display_string']
# We have a resolved top container with a display string
parts << sub_container['top_container']['_resolved']['display_string']
end
end

Expand Down

0 comments on commit ee228b5

Please sign in to comment.