Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 7e3d99e

Browse files
committed
Don't include ui only funders in mets
The ui wants to display and treat as valid funders like “none / other” but we don’t want that stuff to actually make it into dspace so we should not include them in the generated mets. closes #68
1 parent 73fd853 commit 7e3d99e

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

app/models/epdcx.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def expression
5959
end
6060

6161
def funders(submission)
62-
return unless submission.funders.present?
63-
submission.funders.each do |funder|
62+
return unless submission.funders_minus_ui_only_funders.present?
63+
submission.funders_minus_ui_only_funders.each do |funder|
6464
statement('http://libraries.mit.edu/xmlns/sponsor', funder)
6565
end
6666
end

app/models/submission.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,15 @@ def document_uri(document)
8888
end
8989
end
9090

91+
def funders_minus_ui_only_funders
92+
funders - ui_only_funders
93+
end
94+
9195
def valid_funders
96+
submittable_funders + ui_only_funders
97+
end
98+
99+
def submittable_funders
92100
['Department of Defense (DoD)',
93101
'Department of Energy (DOE)',
94102
'Department of Transportation (DOT)',
@@ -97,7 +105,10 @@ def valid_funders
97105
'National Center for Atmospheric Research (NCAR)',
98106
'National Ocean and Atmospheric Administration (NOAA)',
99107
'National Science Foundation (NSF)',
100-
'United States Department of Agriculture (USDA)',
101-
'None / Other']
108+
'United States Department of Agriculture (USDA)']
109+
end
110+
111+
def ui_only_funders
112+
['None / Other']
102113
end
103114
end

test/models/submission_test.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ class SubmissionTest < ActiveSupport::TestCase
6868
assert_not sub.valid?
6969
end
7070

71+
test 'valid with a ui only funder' do
72+
sub = submissions(:sub_one)
73+
sub.funders = ['None / Other']
74+
assert sub.valid?
75+
end
76+
77+
test 'funders_minus_ui_only_funders' do
78+
sub = submissions(:sub_one)
79+
sub.funders << 'None / Other'
80+
assert_equal(sub.funders.include?('None / Other'), true)
81+
assert_equal(sub.funders_minus_ui_only_funders.include?('None / Other'),
82+
false)
83+
end
84+
7185
test 'valid with uri handle' do
7286
sub = submissions(:sub_one)
7387
sub.handle = 'http://example.com/123456/789.0'

0 commit comments

Comments
 (0)