<< | Index | >>
in src/state/admin/package.rb
def delete sequence = @model.parent(@session.app) if(klass = resolve_state(sequence.pointer)) @session.app.delete(@model.pointer) klass.new(@session, sequence) end end
It seems that Package Saving works fine.
Package object is created as Persistence.
ch.oddb> ODBA.cache.fetch('28818516') -> #<ODDB::Package:0x00000003a82b38>
But parent Sequence and Registration does not have reference to this Package.
Problem caused by deletion.
Deleted Package remains in DB.
ch.oddb> delete(ODBA.cache.fetch('28818516').pointer) -> ch.oddb> ODBA.cache.fetch('28818516') -> #<ODDB::Package:0x00000007fdc9b8>
Sequence Model has to implement delete_package.
This delete_package
does not delete Package object(reference only).
def delete_package(ikscd) ikscd = sprintf('%03d', ikscd.to_i) if(pac = @packages.delete(ikscd)) @packages.odba_isolated_store pac # => pack.odba_delete ?? end end
Test case also does not check about deletion of Package Object.
def test_delete_package @seq.packages.store '003', 'package' @seq.delete_package '003' assert_equal({}, @seq.packages) end
Finaly, I Updated only State class.
In Admin::Package state, deleted Package with odba_delete
.
Parts[commercial_form] could not be shown.
src/state/admin/package.rb
if(name = comforms[idx]) if(name.empty?) current.store(:commercial_form, nil) elsif(comform = ODDB::CommercialForm.find_by_name(name)) current.store(:commercial_form, comform.pointer) else @errors.store(:commercial_form, create_error(:e_unknown_comform, :commercial_form, name)) end end
There is expected CommercialForm Object.
This means that Saving is correct.
ch.oddb> ODBA.cache.fetch('1067435').pointer -> :!commercial_form,1067435. ch.oddb> ODBA.cache.fetch('1067435').description -> Tablette(n) ch.oddb>
I have implemented to_s
method for CommercialForm class.
def to_s self.description end
Updated Rezept Form-View and Print-View.