Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
Owner cannot be nil
Browse files Browse the repository at this point in the history
Otherwise ready? or blocked? would issue a Nil pointer exception
  • Loading branch information
jcoyne committed Jul 17, 2018
1 parent 39eb601 commit 3b8a84f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/dor/workflow/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ class Document
t.root(:path => 'workflow')
t.repository(:path => {:attribute => 'repository'})
t.workflowId(:path => {:attribute => 'id'})
t.process {
t.process do
t.name_(:path => {:attribute => 'name'})
t.status(:path => {:attribute => 'status'})
t.timestamp(:path => {:attribute => 'datetime'}) # , :data_type => :date)
t.elapsed(:path => {:attribute => 'elapsed'})
t.lifecycle(:path => {:attribute => 'lifecycle'})
t.attempts(:path => {:attribute => 'attempts'}, :index_as => [:not_searchable])
t.version(:path => {:attribute => 'version'})
}
end
end

@@definitions = {}
Expand Down
6 changes: 4 additions & 2 deletions lib/dor/workflow/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ def elapsed
@attrs['elapsed'].nil? ? nil : @attrs['elapsed'].to_f
end

def update!(info, new_owner = nil)
@owner = new_owner unless new_owner.nil?
# @param info [Nokogiri::XML::Element]
# @param new_owner [Dor::Workflow::Document]
def update!(info, new_owner)
@owner = new_owner
if info.is_a? Nokogiri::XML::Node
info = Hash[info.attributes.collect { |k, v| [k, v.value] }]
end
Expand Down

0 comments on commit 3b8a84f

Please sign in to comment.