<< | Index | >>
update_swissmedic
updator.
Plugin: ODDB::SwissmedicPlugin Error: NoMethodError Message: undefined method `[]' for nil:NilClass Backtrace: /var/www/oddb.org/src/plugin/swissmedic.rb:669:in `update_package' /var/www/oddb.org/src/plugin/swissmedic.rb:758:in `block in update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:749:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:749:in `update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:46:in `update' /var/www/oddb.org/src/util/updater.rb:316:in `block in update_swissmedic' /var/www/oddb.org/src/util/updater.rb:417:in `call' /var/www/oddb.org/src/util/updater.rb:417:in `wrap_update' /var/www/oddb.org/src/util/updater.rb:314:in `update_swissmedic' ...
in src/plugin/swissmedic.rb
p package.class p package p package.parts #=> nil part = package.parts[pidx] part ||= @app.create(package.pointer + :part)
Could not create: :!registration,44208!sequence,01!016!part., reason: :!registration,44208!sequence,01!016!part. -> ODDB::Sequence::package(016) returned nil
This sequence does not have any package.
ch.oddb> registration('44208').sequence('01').package('016').class -> NilClass
in src/model/sequence.rb
def package(ikscd) unless ikscd.is_a?(SBSM::InvalidDataError) if @packages.is_a?(Hash) @packages[sprintf('%03d', ikscd.to_i)] end end end
It seems that problem is the creation of new package.
to create new pointer
ptr = Persistence::Pointer.new([:model, arg]) @app.create(ptr)
in src/util/persistence.rb
def creator Pointer.new([:create, self]) end ... def +(other) dir = @directions.dup << [other].flatten Pointer.new(*dir) end
Could not create: :!registration,44208!sequence,01!016!part., reason: :!registration,44208!sequence,01!016!part. -> ODDB::Sequence::package(016) returned nil
in src/util/persistence.rb
def issue_create ... rescue InvalidPathError, UninitializedPathError => e warn "Could not create: #{to_s}, reason: #{e.message}" end
@app.update((seq.pointer + [:package, cd]).creator, args, :swissmedic) @app.create((package.pointer + [:part]).creator)