<< | Index | >>
Result
Reference
Problem
Note
Note
Experiment
ch.oddb> registration('61815').sequence('02').package('016').name -> Donepezil Actavis 10 mg, Filmtabletten ch.oddb> registration('61815').sequence('02').package('016').compositions.inspect -> [] ch.oddb> registration('61815').sequence('02').compositions -> Tabletten: Donepezili Hydrochloridum 10 mg ch.oddb> registration('62044').sequence('01').package('001').name -> Atorvastatin Axapharm 10 mg, Filmtabletten ch.oddb> registration('62044').sequence('01').package('001').compositions -> Filmtabletten: Atorvastatinum 10 mg
Note
Experiment
def update_compositions(input) saved = nil if(substances = input[:substance]) substances.each { |cmp_idx, substances| doses = input[:dose][cmp_idx] galform = input[:galenic_form][cmp_idx] cmp_idx = cmp_idx.to_i comp = @model.compositions.at(cmp_idx) ptr = comp ? comp.pointer : (@model.pointer + :composition).creator comp = @session.app.update ptr, { :galenic_form => galform }, unique_email substances.each { |sub_idx, sub| ## create missing substance on the fly unless @session.app.substance(sub) sptr = Persistence::Pointer.new(:substance) @session.app.update(sptr.creator, 'lt' => sub) end parts = doses[sub_idx] sub_idx = sub_idx.to_i agent = comp.active_agents.at(sub_idx) ptr = agent ? agent.pointer : (comp.pointer + [:active_agent, sub]).creatorpac = @model.packages.values[0]
p "A"
p pac.compositions.first.to_s
agent = @session.app.update ptr, { :dose => parts, :substance => sub }, unique_emailp "B"
p pac.compositions.first.to_s
unless agent.substance key = :"substance[#{cmp_idx}][#{sub_idx}]" @errors.store key, create_error(:e_unknown_substance, key, sub) end } } end saved end
Run
Result
"A" "Filmtabletten: Atorvastatinum 10 mg" "B" "Filmtabletten: Atorvastatinum 120 mg"
"A" "" "B" ""
Note
Question
Note
Experiment
ch.oddb> registration('61815').sequence('02').package('026').parts.first.composition = registration('61815').sequence('02').compositions.first -> Tabletten: Donepezili Hydrochloridum 120 mg
Reload
Result
Note
Experiment
def update_package(reg, seq, row, replacements={}, opts={:create_only => false}) ... if !part.composition && (comp = seq.compositions[pidx] || seq.compositions.last) args.store :composition, comp.pointer end @app.update(part.pointer, args, :swissmedic) end end