Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Commit

Permalink
Fixing houndci-bot issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
hweng committed May 15, 2018
1 parent b3b1f42 commit 94438b6
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions lib/dams/controller_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Dams
module ControllerHelper

#Mapping for OSF API
#Mapping for OSF API
def osf_title(document)
field_name = "title_json_tesim"
dams_data= document["#{field_name}"]
Expand Down Expand Up @@ -60,7 +60,6 @@ def osf_related_agents(document)
end
end
end

osf_data << {agent_type: "Publisher", type: "Organization", "name": "UC San Diego Library Digital Collections"}
end

Expand Down Expand Up @@ -100,31 +99,43 @@ def agent_type(type)
def osf_extra(document)
field_name = "otherNote_json_tesim"
dams_data = document["#{field_name}"]
osf_data = {}
osf_data = {}

if dams_data != nil
dams_data.each do |datum|
other_note = JSON.parse(datum)
osf_data = { funding: other_note['value'] } if other_note['type'] == 'funding'
end
osf_data = { funding: other_note['value'] } if other_note['type'] == 'funding'
end
end
osf_data
end
end

def osf_description(document)
field_name = "otherNote_json_tesim"
dams_data = document["#{field_name}"]
osf_data = ''
def osf_description(document)
field_name = "otherNote_json_tesim"
dams_data = document["#{field_name}"]
osf_data = ''

if dams_data != nil
dams_data.each do |datum|
dams_data.each do |datum|
other_note = JSON.parse(datum)
osf_data = other_note['value'] if other_note['type'] == 'description'
end
end
end
osf_data
end

def osf_uris(document)
field_name = "id"
dams_data = document["#{field_name}"]
osf_data = {}

if dams_data != nil
url = "http://library.ucsd.edu/dc/collection/#{dams_data}"
osf_data = {"canonicalUri": url, "providerUris": url}
end
osf_data
end

def osf_date_published(document)
field_name = "date_json_tesim"
dams_data = document["#{field_name}"]
Expand Down Expand Up @@ -188,7 +199,7 @@ def osf_mads_fields(document)
end
osf_data
end

def export_to_API(document)
field_map = {
'title': osf_title(document),
Expand All @@ -202,7 +213,7 @@ def export_to_API(document)
json_data = {"jsonData": field_map}
end

# Retrieve label from solr index instead of external record from repo
# Retrieve label from solr index instead of external record from repo
def get_linked_object_label(id)
@doc = get_search_results(:q => "id:#{id}")
field = "name_tesim";
Expand Down

0 comments on commit 94438b6

Please sign in to comment.