<< | Index | >>
suspend
Confirm
Note
Experiment
class AccessoryOfList < AccessoryList def migel_code(model=@model, session=@session) if model.is_a?(DRbObject) # Actually, model is a Migel::Model::Product instance. model.pharmacode else super end end
class PointerSteps < ODDB::View::PointerSteps def pointer_descr(model, session=@session) event = :migel_search link = PointerLink.new(:pointer_descr, model, @session, self) if model.is_a?(DRbObject) # This is the case where Product instance comes from migel DRb server # DRbObject is acutally Migel::Model::Group, Subgroup class. see lib/migel/model/migelid.rb in migel project. key = if model.migel_code.length == 2 :migel_group else :migel_subgroup end elsif model.is_a?(ODDB::Migel::Group) key = :migel_group elsif model.is_a?(ODDB::Migel::Subgroup) key = :migel_subgroup end link.href = @lookandfeel._event_url(event, {key => model.migel_code.delete('.')}) link end end
class Product < View::PrivateTemplate CONTENT = ProductComposite SNAPBACK_EVENT = :result def backtracking(model, session=@session) ODDB::View::Migel::PointerSteps.new(model, @session, self) end end
Access
Result
Next
class ProductInnerComposite < HtmlGrid::Composite def group(model) pointer_link(model.group, :migel_group) end def subgroup(model) pointer_link(model.subgroup, :migel_subgroup) end def pointer_link(model, key) link = PointerLink.new(:to_s, model, @session, self) link.value = model.send(@session.language) event = :migel_search link.href = @lookandfeel._event_url(event, {key => model.migel_code.delete('.')}) link end
Access
Result
def search_migel_subgroup(migel_code) code = migel_code.split(/(\d\d)/).select{|x| !x.empty?}.join('.') ret = MIGEL_SERVER.subgroup.find_by_migel_code(code) ret end
def structural_ancestors(app) [group] end
class ProductList < HtmlGrid::List def migel_code(model) unless model.items.empty? link = PointerLink.new(:migel_code, model, @session, self) event = :migel_search key = :migel_code link.href = @lookandfeel._event_url(event, {key => model.migel_code.delete('.')}) link else model.migel_code end end def description(model) link = PointerLink.new(:to_s, model, @session, self) text = [ model, (model.product_text if(model.respond_to?(:product_text))), ].compact.collect { |item| item.send(@session.language) }.join(': ').gsub("\n", ' ') if(text.size > 60) text = text[0,57] << '...' end link.value = text event = :migel_search key = :migel_product link.href = @lookandfeel._event_url(event, {key => model.migel_code.delete('.')}) link end
class SubgroupInnerComposite < HtmlGrid::Composite def pointer_link(model) link = PointerLink.new(:to_s, model, @session, self) link.value = model.send(@session.language) event = :migel_search key = :migel_group link.href = @lookandfeel._event_url(event, {key => model.migel_code}) link end
# Note: ODDB::View::Migel::PointerSteps is defined in src/view/migel/product.rb class Subgroup < View::PrivateTemplate CONTENT = SubgroupComposite SNAPBACK_EVENT = :result def backtracking(model, session=@session) ODDB::View::Migel::PointerSteps.new(model, @session, self) end end
Access
Result
Next
class SubgroupList < HtmlGrid::List def migel_code(model=@model, session=@session) link = PointerLink.new(:migel_code, model, @session, self) event = :migel_search key = :migel_subgroup link.href = @lookandfeel._event_url(event, {key => model.migel_code.delete('.')}) link end end
Access
Result
Problem
Note
suspend
Problem
Experiment
migel> Migel::Model::Migelid.search_by_name('Wegwerf').length -> 1 migel> Migel::Model::Migelid.search_by_name('Wegwerf-Scheidenpessar').length -> 1 migel> Migel::Model::Migelid.search_by_name('Wegwerf-Scheidenp').length -> 1 migel> Migel::Model::Migelid.search_by_name('Scheidenpessar').length -> 1 migel> Migel::Model::Migelid.search_by_name('Scheidenpes').length -> 1 migel> Migel::Model::Migelid.search_by_name('WegwerfScheidenpessar').length -> 0
Experiment
def search_migel_products(query, lang) migel_code = if query =~ /(\d){9}/ query.split(/(\d\d)/).select{|x| !x.empty?}.join('.') elsif query =~ /(\d\d\.){4}\d/ query end if migel_code MIGEL_SERVER.migelid.search_by_migel_code(migel_code) else p query.class p query MIGEL_SERVER.migelid.search_by_name(query).concat( MIGEL_SERVER.subgroup.search_by_name(query).concat( MIGEL_SERVER.group.search_by_name(query) ) ) end end
Access
Result
String "WegwerfScheidenpessar"
Note
Solution
Experiment (This is a temporary solution)
def search zone = @session.zone query = @session.persistent_user_input(:search_query) if(query.is_a? RuntimeError) State::Exception.new(@session, query) elsif(!query.nil?)if zone == :migel
query = query.to_s.gsub(//u,'')
else
query = ODDB.search_term(query)
end
Access
Result
def search_migel_products(query, lang)
migel_code = if query =~ /(\d){9}/
query.split(/(\d\d)/).select{|x| !x.empty?}.join('.')
elsif query =~ /(\d\d\.){4}\d/
query
end
if migel_code
MIGEL_SERVER.migelid.search_by_migel_code(migel_code)
else
MIGEL_SERVER.subgroup.search_by_name(query)
end
end
Access
Result
Log
error in SBSM::Session#process: /de/gcc/search/zone/migel/search_query/Urin-Bettbeutel NoMethodError undefined method `subgroup' for #<Migel::Model::Subgroup:0x7fbf84ae5e98> (druby://localhost:10000) /home/masa/ywesee/oddb.org/src/state/migel/result.rb:33:in `init' (druby://localhost:10000) /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `call' (druby://localhost:33000) /usr/lib64/ruby/1.8/drb/invokemethod.rb:10:in `block_yield' (druby://localhost:33000) /usr/lib64/ruby/1.8/drb/invokemethod.rb:17:in `perform_with_block' (druby://localhost:33000) /usr/lib64/ruby/1.8/drb/invokemethod.rb:14:in `each'
Note
Experiment
def search_migel_products(query, lang) migel_code = if query =~ /(\d){9}/ query.split(/(\d\d)/).select{|x| !x.empty?}.join('.') elsif query =~ /(\d\d\.){4}\d/ query end if migel_code MIGEL_SERVER.migelid.search_by_migel_code(migel_code) elseif group = MIGEL_SERVER.group.search_by_name(query).first
group.subgroups.collect{|sg| sg.migelids}.flatten
elsif subgroup = MIGEL_SERVER.subgroup.search_by_name(query).first
subgroup.migelids
else
MIGEL_SERVER.migelid.search_by_name(query)
end
end end
Access
Result
Experiment
link = PointerLink.new(:to_s, model, @session, self) text = [ model, (model.product_text if(model.respond_to?(:product_text))), ].compact.collect { |item| item.send(@session.language) }.join(': ').gsub("\n", ' ') if(text.size > 60) text = text[0,57] << '...' endkey = if model.migel_code.length == 2
:migel_group
elsif model.migel_code.length == 5
:migel_subgroup
else
:migel_product
end
link.href = @lookandfeel._event_url(:migel_search, {key => model.migel_code.gsub(/\./, '')}) link.value = text link
Result
Problem
Experiment
def limitation_text(model) if(sltxt = model.limitation_text and !sltxt.to_s.empty?) limitation_link(sltxt) else '' end end
Result
Note