<< | Index | >>
Goal/Estimate/Evaluation:
suspend
Log in the last Friday
migel> Migel::Importer.new.update_all_products true -> /home/masa/ywesee/migel/lib/migel/importer.rb:200:in `search_migel_table': wrong number of arguments (2 for 1)
Commit
Experiment
masa@masa ~/ywesee/migel $ sudo -u postgres dropdb migel masa@masa ~/ywesee/migel $ sudo -u postgres createdb -E UTF8 -T template0 migel masa@masa ~/ywesee/migel $ bin/migeld
migel> Migel::Importer.new.update('data/csv/migel_de_test.csv','de')
migel> Migel::Importer.new.update('data/csv/migel_fr_test.csv','fr')
Problem
NoMethodError undefined method `<=>' for nil:NilClass (druby://localhost:33000) /home/masa/ywesee/migel/lib/migel/util/multilingual.rb:31:in `sort' (druby://localhost:33000) /home/masa/ywesee/migel/lib/migel/util/multilingual.rb:31:in `to_s' /home/masa/ywesee/oddb.org/src/view/migel/result.rb:73:in `limitation_text' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create'
Log on console
WARNING: nonstandard use of \' in a string literal LINE 2: VALUES (39, 'catetere monouso con lubrificante / c... ^ HINT: Use '' to write quotes in strings, or use the escape string syntax (E'...'). WARNING: nonstandard use of \' in a string literal LINE 2: VALUES (41, 'catetere monouso con lubrificante / c... ^ HINT: Use '' to write quotes in strings, or use the escape string syntax (E'...'). WARNING: nonstandard use of \' in a string literal LINE 2: VALUES (103, 'apparecchi per la terapia dell\'enur... ^ HINT: Use '' to write quotes in strings, or use the escape string syntax (E'...').
Note
Experiment
multilingual_data = { :name => name, :migelid_text => migelid_text, :limitation_text => limitation_text, :unit => unit, }
Result
Experiment
migel> Migel::Model::Migelid.find_by_migel_code('15.30.50.00.1').name.fr -> Pessaire jetable migel> Migel::Model::Migelid.find_by_migel_code('15.30.50.00.1').name.de -> Wegwerf-Scheidenpessar migel> Migel::Model::Migelid.find_by_name('Pessaire jetable').migel_code -> 15.30.50.00.1 migel> Migel::Model::Migelid.find_by_name('Wegwerf-Scheidenpessar').class
Note
Question
Experiment
odba_index :name_de, 'name.de' odba_index :name_fr, 'name.fr'
def search_migel_alphabetical(query, lang) #MIGEL_SERVER.migelid.search_by_name(query) search_method = 'search_by_name_' + lang.downcase.to_s MIGEL_SERVER.migelid.send(search_method, query) end
Result
migel> Migel::Model::Migelid.find_by_name_fr('Pessaire jetable').migel_code -> 15.30.50.00.1 migel> Migel::Model::Migelid.find_by_name_de('Wegwerf-Scheidenpessar').migel_code -> 15.30.50.00.1
Next
odba_index :name_de, 'name.de' odba_index :name_fr, 'name.fr'
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 search_method = 'search_by_name_' + lang.downcase.to_s #if group = MIGEL_SERVER.group.search_by_name(query).first if group = MIGEL_SERVER.group.send(search_method, query).first result = group.subgroups.collect{|sg| sg.migelids}.flatten #elsif subgroup = MIGEL_SERVER.subgroup.search_by_name(query).first elsif subgroup = MIGEL_SERVER.subgroup.send(search_method, query).first subgroup.migelids else #MIGEL_SERVER.migelid.search_by_name(query) MIGEL_SERVER.migelid.send(search_method, query) end end end
Restore database
masa@masa ~/ywesee/migel $ sudo -u postgres dropdb migel masa@masa ~/ywesee/migel $ sudo -u postgres createdb -E UTF8 -T template0 migel masa@masa ~/ywesee/migel $ bin/migeld
migel> Migel::Importer.new.update('data/csv/migel_de_one.csv','de') -> 15.INKONTINENZHILFEN15.30Pessare15.30.50.00.1Wegwerf-Scheidenpessar1Stück3.60 01.01.2002 migel> Migel::Importer.new.update('data/csv/migel_fr_one.csv','fr') -> 15.AIDES POUR L’INCONTINENCE15.30Pessaires15.30.50.00.1Pessaire jetable1pièce3.60 01.01.2002
Run
Result
Good
Good
Next
Looks working
module Migel module Model class Product < ModelSuper odba_index :pharmacode odba_index :ean_code #odba_index :article_name odba_index :name_de, 'name.de' odba_index :name_fr, 'name.fr' #odba_index :companyname odba_index :company_name_de, 'company_name.de' odba_index :company_name_fr, 'company_name.fr' end end end
#elsif result = @session.app.search_migel_items(query) and !result.empty? elsif result = @session.app.search_migel_items(query, @session.language) and !result.empty? State::Migel::Items.new(@session, result)
def search_migel_items(query, lang) search_method_article_name = 'search_by_name_' + lang.downcase.to_s search_method_company_name = 'search_by_company_name_' + lang.downcase.to_s #MIGEL_SERVER.product.search_by_article_name(query) + MIGEL_SERVER.product.search_by_companyname(query) MIGEL_SERVER.product.send(search_method_article_name, query) + MIGEL_SERVER.product.send(search_method_company_name, query) end
def update_product(migelid, record, lang = 'de') lang.downcase! ... #product.article_name = record[:article_name] product.send(:article_name).send(lang.to_s + "=", record[:article_name]) #product.companyname = record[:companyname] product.send(:companyname).send(lang.to_s + "=", record[:companyname])
def search_migel_table(code, query_key = 'Pharmacode', lang = 'DE') ... migel_item = if pharmacode = line[0] and pharmacode.match(/\d{7}/) and swissindex_item = search_item(pharmacode, lang)
Restore database
masa@masa ~/ywesee/migel $ sudo -u postgres dropdb migel masa@masa ~/ywesee/migel $ sudo -u postgres createdb -E UTF8 -T template0 migel masa@masa ~/ywesee/migel $ bin/migeld
migel> Migel::Importer.new.update('data/csv/migel_de_test.csv','de') -> Array migel> Migel::Importer.new.update('data/csv/migel_fr_test.csv','fr') -> Array migel> Migel::Importer.new.update_products_by_migel_code('15.30.50.00.1', 'de') -> Array migel> Migel::Importer.new.update_products_by_migel_code('15.30.50.00.1', 'fr') -> Array
Result
Note
multilingual :size
#product.size = record[:size] product.send(:size).send(lang.to_s + "=", record[:size])
def size(model = @model, session = @session) if model.size.respond_to?(session.language) model.size.send(session.language) else model.size end end
Result
Commit
Task
Design
Note
Experiment
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> registration('61848').generic_type -> generic ch.oddb> registration('61848').generic_type -> original ch.oddb> registration('61848').generic_type.class -> Symbol ch.oddb> registration('61848').generic_type.class -> NilClass
Note