< Niklaus.20141217-fix-address-correction | 2014 | Niklaus.20141215-fix-hospital >>
---
http://oddb-ci2.dyndns.org/de/gcc/suggest_address/pharmacy/7601001380028/address/0/zone/pharmacies displays correctly, but pressing the submit button leads to
error in SBSM::Session#process: /de/gcc NoMethodError undefined method `parent' for nil:NilClass /var/www/oddb.org/src/util/persistence.rb:92:in `parent' /var/www/oddb.org/src/state/suggest_address.rb:43:in `save_suggestion' /var/www/oddb.org/src/state/suggest_address.rb:15:in `address_send' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/state.rb:203:in `_trigger' /var/www/oddb.org/src/state/global.rb:1004:in `_trigger' SuggestAddressForm for #<ODDB::Address2:0x007fa899a00d68 @additional_lines=[], @name="Apotheke Moor", @fax=[], @address="Zaunplatz 2", @fon=[], @location="8750 Glarus", @odba_id=32375336, @revision=2014-12-01 17:03:28 +0100, @oid=32375336, @data_origins={}> hospital ean SuggestAddressForm address_message #<ODDB::Address2:0x007fa899a00d68 @additional_lines=[], @name="Apotheke Moor", @fax=[], @address="Zaunplatz 2", @fon=[], @location="8750 Glarus", @odba_id=32375336, @revision=2014-12-01 17:03:28 +0100, @oid=32375336, @data_origins={}>
Error looks like this after a fresh start of oddbd
system initialized initialized: 11.023205876 SuggestAddressForm for #<ODDB::Address2:0x00000007270ef0 @additional_lines=[], @fax=[], @fon=[], @address="Zaunplatz 2", @location="8750 Glarus", @revision=2014-12-01 17:03:28 +0100, @odba_id=32375336, @oid=32375336, @name="Apotheke Moor"> hospital ean SuggestAddressForm address_message #<ODDB::Address2:0x00000007270ef0 @additional_lines=[], @fax=[], @fon=[], @address="Zaunplatz 2", @location="8750 Glarus", @revision=2014-12-01 17:03:28 +0100, @odba_id=32375336, @oid=32375336, @data_origins={}, @name="Apotheke Moor"> Before submitting via "Vorschlag senden" error in SBSM::Session#process: /de/gcc NoMethodError undefined method `parent' for nil:NilClass /var/www/oddb.org/src/util/persistence.rb:92:in `parent' /var/www/oddb.org/src/state/suggest_address.rb:43:in `save_suggestion' /var/www/oddb.org/src/state/suggest_address.rb:15:in `address_send' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/state.rb:203:in `_trigger' /var/www/oddb.org/src/state/global.rb:1004:in `_trigger' SuggestAddressForm for #<ODDB::Address2:0x00000007270ef0 @additional_lines=[], @fax=[], @fon=[], @address="Zaunplatz 2", @location="8750 Glarus", @revision=2014-12-01 17:03:28 +0100, @odba_id=32375336, @oid=32375336, @data_origins={}, @name="Apotheke Moor"> hospital ean SuggestAddressForm address_message #<ODDB::Address2:0x00000007270ef0 @additional_lines=[], @fax=[], @fon=[], @address="Zaunplatz 2", @location="8750 Glarus", @revision=2014-12-01 17:03:28 +0100, @odba_id=32375336, @oid=32375336, @data_origins={}, @name="Apotheke Moor">
The problem is that the import of the pharmacies did not set correctly the parent field for the imported addres. Eg. bin/admin tells
ch.oddb> hospital("7601002017145").name -> Kantonsspital Glarus ch.oddb> hospital("7601002017145").addresses.first.parent(0) -> #<ODDB::Hospital:0x0000000af264f8> ch.oddb> pharmacy_by_gln(7601001396043).name -> St. Fridolin Pharma AG ch.oddb> pharmacy_by_gln(7601001396043).addresses.first.parent(0) -> undefined method `parent' for nil:NilClass
The same problem might be present for newly imported doctors. Wrong conclusion. After looking at http://dev.ywesee.com/Masa/20111026-change-admin-link-format-oddbOrg I did see, that I did not calculate a parent for the pharmacy in src/state/admin/address_suggestion.rb.
Fixed this problem. But now I get the following error after sending the suggestion (which arrived correctly):
Util.log_and_deliver_mail to=["ngiger@ywesee.com"] subject Addressänderungsvorschlag für: St. Fridolin Pharma AG size 86 with 0 attachments. http://oddb-ci2.dyndns.org/de/gcc/resolve/pointer/%3A%21address_suggestion%2C32401454. error in SBSM::Session#to_html: /de/gcc NoMethodError undefined method `parent' for nil:NilClass /var/www/oddb.org/src/view/suggest_address_confirm.rb:27:in `go_back' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `compose' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:57:in `init' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/component.rb:139:in `initialize' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:61:in `new' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:61:in `create' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `compose' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:57:in `init' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/component.rb:139:in `initialize' /var/www/oddb.org/src/view/publictemplate.rb:62:in `new' /var/www/oddb.org/src/view/publictemplate.rb:62:in `content' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `compose' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:57:in `init' /var/www/oddb.org/src/view/publictemplate.rb:59:in `init' /var/www/oddb.org/src/view/privatetemplate.rb:17:in `init' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/component.rb:139:in `initialize' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/state.rb:245:in `new' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/state.rb:245:in `view' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/state.rb:181:in `to_html' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/session.rb:448:in `to_html' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/session.rb:173:in `block in drb_process' <internal:prelude>:10:in `synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/session.rb:171:in `drb_process' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop' /usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop' ODDB::View::AddressSent::COMPONENTS[[1, 0]] in create(go_back) ODDB::View::AddressConfirmComposite::COMPONENTS[[0, 1]] in create(ODDB::View::AddressSent) ODDB::View::AddressConfirm::COMPONENTS[[0, 3]] in create(content) error in SBSM::Session#http_headers: /de/gcc NoMethodError undefined method `parent' for nil:NilClass /var/www/oddb.org/src/view/suggest_address_confirm.rb:27:in `go_back' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each'
Fixed. When visiting the URL received by a suggestion for the doctor I get
NameError undefined local variable or method `oid' for #<ODDB::State::Doctors::RootDoctor:0x007fb00d3402a0> /var/www/oddb.org/src/state/admin/root.rb:100:in `address_suggestion' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/state.rb:203:in `_trigger' /var/www/oddb.org/src/state/global.rb:1004:in `_trigger' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/state.rb:192:in `trigger' /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.5/lib/sbsm/viralstate.rb:36:in `trigger'
Extracting the ean from the session.request_path helps to get the correct address_suggestion. However I had problems now to send the email, because I forgot to return the correct result after adding a printf. Now sending email works for hospitals/doctors/pharmacies but content is not wrong. Always contains only the name of the first sent correction. Instead of a full url I only get a word like 'Hospital'.
Status:
Die von Ihnen gewünschte Information ist leider nicht mehr vorhanden.
Created watir tests.
I think the problem is that neither pharmacies nor their addresses have the pointer set correctly. Tried to set it for one pharmacy using
pharmacy_by_gln(7601001396043).pointer = Persistence::Pointer.new(:pharmacy).creator
. Did a similar stuff for its address pharmacy_by_gln(7601001396043).addresses.first.pointer = Persistence::Pointer.new([:pharmacy, pharmacy_by_gln(7601001396043).oid, :address,0])
but this did not resolve the problem.
Trying to force the persisten_user_input(:ean) depending on the request_path, made it a little bit better, but the e-mails returned a link to http://oddb-ci2.dyndns.org/de/gcc/resolve/pointer/%3A%21address_suggestion%2C32401534, whereas the doctors/hospitals showed the correct links with the EAN and the OID e.g. http://oddb-ci2.dyndns.org/de/gcc/address_suggestion/doctor/7601000254207/oid/32401532.
Now I send the the Link http://oddb-ci2.dyndns.org/de/gcc/address_suggestion/pharmacy/7601001380028/oid/32401536, which looks okay, but get the error
error in SBSM::Session#http_headers: /de/gcc/address_suggestion/pharmacy/7601001380028/oid/32401536 NoMethodError undefined method `active_address' for #<ODDB::State::Drugs::Init:0x00000008be4f30> /var/www/oddb.org/src/view/admin/address_suggestion.rb:129:in `address' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each'
Will look at this error tomorrow.