Skip to content

Commit

Permalink
Fix rake task for types
Browse files Browse the repository at this point in the history
Added more types and also case of blank agency
  • Loading branch information
richardhallett committed Oct 2, 2020
1 parent 1cdcc6b commit fecec06
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2325,9 +2325,31 @@ def self.add_index_type(options={})

Doi.where(id: from_id..until_id).where('type' => nil).find_each(batch_size: 500) do |doi|
begin
if doi.agency.casecmp?("datacite")
if doi.agency.blank? || doi.agency.casecmp?("datacite")
type = "DataciteDoi"
elsif doi.agency.casecmp?("crossref")
else
type = "OtherDoi"
end

agency = doi.agency

if agency.blank? || agency.casecmp?("datacite")
type = "DataciteDoi"
elsif agency.casecmp?("crossref")
type = "OtherDoi"
elsif agency.casecmp?("kisti")
type = "OtherDoi"
elsif agency.casecmp?("medra")
type = "OtherDoi"
elsif agency.casecmp?("istic")
type = "OtherDoi"
elsif agency.casecmp?("jalc")
type = "OtherDoi"
elsif agency.casecmp?("airiti")
type = "OtherDoi"
elsif agency.casecmp?("cnki")
type = "OtherDoi"
elsif agency.casecmp?("op")
type = "OtherDoi"
else
type = "DataciteDoi"
Expand Down

0 comments on commit fecec06

Please sign in to comment.