view · edit · sidebar · attach · print · history

20120726-debug-package-saving-and-deletion

<< | Index | >>


Summary

  • Checked Package creation/deletion.
  • Debuged Sequence#delete_package.
    • It does not delete Package Object (Connection only)
  • Improved Prescription Print View.

Commits

Index


Debug Package Saving

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.


Debug Package Deletion

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

Test case also does not check about deletion of Package Object.

in test/test_model/sequence.rb
 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.

commit

Debug Package parts

Problem

Parts[commercial_form] could not be shown.

in 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
commit

Update Rezept print view

Updated Rezept Form-View and Print-View.

Form

Print Layout

commit
view · edit · sidebar · attach · print · history
Page last modified on July 26, 2012, at 12:26 PM