view · edit · sidebar · attach · print · history

20120222-mail-order-price-and-htmlgrid

<< | Index | >>


summary

  • checked import_mail_order_price job for `mail_order_price` on mymedi lookandfeel.
  • checked htmlgrid.

commits

index


mail_order_price

mymedi is new lookandfeel.
checked mail_order_price jobs for this new lookandfeel.

get logo following files into zurrose via git.

  • doc/resources/zurrose/Logo_R.jpg
  • doc/resources/zurrose/zurRose.jpg

use this csv file.

then tried job

$ jobs/import_mail_order_price 'mail_order_prices.csv' 'Logo_R.jpg'

NOTE: ARGV[1] is only file name (not path).

see MailOrderPricePlugin::update in src/plugin/mail_order_price.rb

result mail

I could get result notification like this.

# title
ch.ODDB.org Report - Update Mail Order Prices - 02/2012

# body
Updated Packages: 2 

lookandfeel

Edit src/custom/lookandfeelwrapper.rb
uncommented follows 2 lines.

...
 [10,0]  =>  :mail_order_price,
 [11,0]  =>  :additional_mail_order_price0,
...

After restart oddbd. I could new price column `Versandapotheke`.
But I could not see the logo image.

updated LOGO_PATH

greped 'mail_order_price' in src directory.
And updated LOGO_PATH constant.

src/view/drugs/resultlist.rb

diff --git a/src/view/drugs/resultlist.rb b/src/view/drugs/resultlist.rb
index 4555482..9484fda 100644
--- a/src/view/drugs/resultlist.rb
+++ b/src/view/drugs/resultlist.rb
@@ -102,7 +102,7 @@ class AtcHeader < HtmlGrid::Composite
        end
 end
 class MailOrderPriceLogo < HtmlGrid::NamedComponent
-  LOGO_PATH = "http://#{SERVER_NAME}/resources/logos/"
+  LOGO_PATH = "http://#{SERVER_NAME}/resources/zurrose/"
   def init
     super
     @index = 0

Now, I could see logo image.

refs


htmlgrid

current grid.rb is /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.4/lib/htmlgrid/grid.rb (installed via gem)

git pull then copied updated 2 files to /var/www/oddb.org.

$ sudo cp lib/htmlgrid/composite.rb /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.4/lib/htmlgrid/composite.rb
$ sudo cp lib/htmlgrid/grid.rb /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.4/lib/htmlgrid/grid.rb

and commented out followings.

...
begin
  VERSION = '1.0.4'
#  begin
#    # for gem install
#    ext_dir = File.expand_path('../../ext/htmlgrid', File.dirname(__FILE__))
#    ext_lib = File.join(ext_dir, 'htmlgrid.so')
#    require ext_lib
#  rescue LoadError
#    # for setup.rb install
#    require 'htmlgrid.so'
#  end
#rescue LoadError
# puts "could not find htmlgrid.so, falling back to pure-ruby class"
  module HtmlGrid
...

reboot oddbd.
It works fine.

recycled_object

tried following error.

refs

  1. . login
  2. . click Admin->Benutzer
  3. . click Admin-Home

When I reloaded, got same error.

in browser.

RangeError
0xdb82a73e is recycled object

outputed oddbd error.

attachments

Is it retate to gabage collection ?
checked fixed commits

refs

in src/view/centeredsearchform.rb

- image = HtmlGrid::Input.new(:submit, model, session, self)
+ image = HtmlGrid::Input.new(:submit, nil, session, self)

this model object is fachinfo_news.

'model'

#<OpenStruct fachinfo_news=[
  #<ODBA::Stub:86262270#28499343 @odba_class=ODDB::Fachinfo @odba_container=97310000#21>, 
  ...
]

Admin view does't need this fachinfo_news object.
The problem seems that releasing of news object by druby.

This is a referenced object.

upgraded new htmlgrid gem. (commented again.)

NoMethodError

I found other error.

  1. . click addresses in menu.
error in SBSM::Session#http_headers: /de/gcc/addresses/
NoMethodError
undefined method `time' for #<Array:0xc766edc>
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.0.8/lib/odba/stub.rb:112:in `method_missing'
/var/www/oddb.org/src/view/admin/addresses.rb:46:in `time'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.4/lib/htmlgrid/composite.rb:67:in `create'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.4/lib/htmlgrid/composite.rb:281:in `compose_component'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.4/lib/htmlgrid/composite.rb:210:in `block in compose'

added following debugging code in '/var/www/oddb.org/src/view/admin/addresses.rb'

def time(model)
  p model.class
  p model
  if(time = model.time)
    link = PointerLink.new(:time, model, @session,self)
    fmt = @lookandfeel.lookup(:time_format_long)
    link.value = time.strftime(fmt)
    link.href = model.url if model.url
    link
  end 
end 

output.

could not sort: undefined method `time' for #<Array:0xa61fa94>
ODDB::AddressSuggestion
#<ODBA::Stub:89075010#28481791 @odba_class=ODDB::AddressSuggestion @odba_container=89956240#780360>
ODDB::AddressSuggestion
#<ODBA::Stub:89075400#22460670 @odba_class=ODDB::AddressSuggestion @odba_container=89956240#780360>
ODDB::AddressSuggestion
#<ODBA::Stub:89075780#28481789 @odba_class=ODDB::AddressSuggestion @odba_container=89956240#780360>
ODDB::AddressSuggestion
#<ODBA::Stub:89076210#27550461 @odba_class=ODDB::AddressSuggestion @odba_container=89956240#780360>
ODDB::AddressSuggestion
#<ODBA::Stub:89076610#26298093 @odba_class=ODDB::AddressSuggestion @odba_container=89956240#780360>
ODDB::AddressSuggestion
#<ODBA::Stub:89077060#22658537 @odba_class=ODDB::AddressSuggestion @odba_container=89956240#780360>
ODDB::AddressSuggestion
#<ODBA::Stub:89077360#23280872 @odba_class=ODDB::AddressSuggestion @odba_container=89956240#780360>
Array
#<ODBA::Stub:89077880#28237279 @odba_class=Array @odba_container=89956240#780360>
error in SBSM::Session#http_headers: /de/gcc/addresses/
NoMethodError
undefined method `time' for #<Array:0xa61fa94>

this time method expected AddressSuggestion object. But, I don't have to fix it.

I also tride delete array data via bin/admin.

ch.oddb> address_suggestions.values.map{|ad| ad.class}.uniq.count
-> 2
ch.oddb> address_suggestions.values.select{|ad| ad.is_a?(Array)}.first.odba_id
-> 28237279
ch.oddb> address_suggestion(28237279).class
-> Array
ch.oddb> address_suggestions.values.select{|ad| ad.is_a?(AddressSuggestion)}.first.odba_id
-> 11177740
ch.oddb> address_suggestion(11177740).class
-> ODDB::AddressSuggestion
ch.oddb> delete_address_suggestion(28237279)
-> Array
ch.oddb> address_suggestions.values.select{|ad| ad.is_a?(Array)}
-> []

It works.

view · edit · sidebar · attach · print · history
Page last modified on February 23, 2012, at 06:34 PM