Skip to content

Commit

Permalink
import metadata if xml column nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Dec 27, 2018
1 parent 997e7fd commit e10bc49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def self.import_by_day_missing(options={})

logger = Logger.new(STDOUT)

Doi.where(schema_version: nil).where(created: from_date.midnight..from_date.end_of_day).find_each do |doi|
Doi.where(xml: nil).where(created: from_date.midnight..from_date.end_of_day).find_each do |doi|
begin
string = doi.current_metadata.present? ? doi.from_xml(doi.current_metadata.xml.to_s.force_encoding("UTF-8")) : nil
unless string.present?
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/doi_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DoiSerializer
has_many :media

attribute :xml, if: Proc.new { |object, params| params && params[:detail] } do |object|
object.xml_encoded || object.current_metadata.present? ? object.from_xml(object.current_metadata.xml.to_s.force_encoding("UTF-8")) : nil
object.xml_encoded
end

attribute :doi do |object|
Expand Down

0 comments on commit e10bc49

Please sign in to comment.