Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3163 Don't include the DwcOccurrence id column in DwC exports #3789

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/dwc_occurrence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def self.target_columns
# @return [Array]
# of symbols
def self.excluded_columns
::DwcOccurrence.columns.collect{|c| c.name.to_sym} - (self.target_columns - [:dwc_occurrence_object_id, :dwc_occurrence_object_type])
::DwcOccurrence.columns.collect{|c| c.name.to_sym} - (self.target_columns - [:id, :dwc_occurrence_object_id, :dwc_occurrence_object_type])
end

# @return [Scope]
Expand Down
1 change: 0 additions & 1 deletion lib/export/dwca/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ def biological_associations_resource_relationship
def meta_fields
return [] if no_records?
h = File.open(all_data, &:gets)&.strip&.split("\t")
h&.shift
h || []
end

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/export/dwca/data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
end

specify 'generated headers are restricted to data' do
expect(csv.headers).to contain_exactly(*(['id'] + headers))
expect(csv.headers).to contain_exactly(*headers)
end

specify '#meta_fields can be returned, and exclude id' do
Expand Down
4 changes: 4 additions & 0 deletions spec/models/dwc_occurrence_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
expect(DwcOccurrence.target_columns).to include(:occurrenceID)
end

specify '.excluded_columns must include id' do
expect(DwcOccurrence.excluded_columns).to include(:id)
end

specify 'extending predicates' do
include ActiveJob::TestHelper

Expand Down