view · edit · sidebar · attach · print · history

Index>

20170426-virbac-importer

Summary

  • Fix virbac importer
  • Run Drugshortage Update after FI and PI Update
  • Keep in Mind

Commits

Index

Fix virbac importer

Must add a correctly working bin/virbac_admin. Done with commit Add bin/virbac_admin

Now I have the following two problems on oddb-ci2

  • After running the bin/update_abschluss_artikel_artikel_fr_kunden twice I see two non active customers with ID 3219
  • bin/virbac_admin does not connect correctly to the virbac DRb service running on port 12003 (which works nice on fastpower)

The second point was fixed by correcting the server_url in etc/config.yml. After dropping and reloading the database I see only one customer (ID=700959) when visiting http://virbac.bbmb.ngiger.ch/de/bbmb/customers/filter/Bachmann.

Adapting CSV-Importer to delete all object which do not have the correct class.

After runnig sudo -u bbmb /usr/local/bin/bundle-240 exec /usr/local/bin/ruby-240 bin/update_abschluss_artikel_artikel_fr_kunden config=/var/www/virbac.bbmb.ch/etc/config.yml I see 50 Created new customer_id. Tried accessing 5 of them (4325, 3934, 4004, 4040, 701019) which showed the desired results But in http://virbac.bbmb.ngiger.ch/de/bbmb/customer/customer_id/3219 I still have NoMethodError undefined method `customer_id' for nil:NilClass

Examining the problem using bin/virbac_admin shows that this is an Array and not a Customer. Deleting it with

ch.bbmb.virbac> BBMB::Model::Customer.odba_extent.find_all{|x| x.customer_id.to_i == 3219 }.class
-> 
Array
ch.bbmb.virbac> BBMB::Model::Customer.odba_extent.find_all{|x| x.customer_id.to_i == 3219 }.size
-> 
 BBMB::Model::Customer.odba_extent.find_all{|x| x.customer_id.to_i == 3219 }.first.odba_delete
1
ch.bbmb.virbac> BBMB::Model::Customer.odba_extent.find_all{|x| x.customer_id.to_i == 3219 }.first.odba_id
-> 
269573
ch.bbmb.virbac> BBMB::Model::Customer.odba_extent.find_all{|x| x.customer_id.to_i == 3219 }.odba_id
-> 
270442
ch.bbmb.virbac> BBMB::Model::Customer.odba_extent.find_all{|x| x.customer_id.to_i == 3219 }.first.odba_delete
-> 
#<BBMB::Model::Customer:0x00000002ff2718>
ch.bbmb.virbac> BBMB::Model::Customer.odba_extent.find_all{|x| x.customer_id.to_i == 3219 }
-> 
[]

Rerunning import. Also ran sudo -u bbmb /usr/local/bin/ruby231 virbac_migrate_to_utf_8 to fix the UTF-8 problems. Did Zeno restore once a non converted DB or is the generated backup not UTF-8? Also virbac-yus is still using ruby186. Changing it to use ruby240 on oddb-ci2, by changing /service/virbac.bbmb.ch-yus/run to

#!/bin/sh
exec 2>&1
exec sudo -u bbmb /usr/local/bin/ruby-240 /usr/local/bin/yusd config=/var/www/virbac.bbmb.ch/etc/yus.yml

Migrated virbac-yus by calling sudo -u bbmb /usr/local/bin/ruby-240 /usr/local/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/yus-1.0.4/yus_migrate_to_utf_8 config=/var/www/virbac.bbmb.ch/etc/yus.yml

Discovered that http://virbac.bbmb.ch/de/bbmb/customer/customer_id/4202 displays "@" as name, with Silvia Gentilcore, Elestastrasse 26, 7310 Bad Ragaz, whereas it should be (from KUNDEN.CSV line 707) 4202,"A","VETtrust AG","Kleintierpraxis Flora","9500","Wil","Florastrasse 5","huvos@thurweb.ch","D ","SG", Why?

Also virbac.bbmb.ch has some problems with umlauts, eg., 4060 Abbühl but not with others, eg. 4325 & Bruno Unternährer.

Added odba_store after changing the content of the products, as some changes were not written correctly. Now the import takes much longer. E.g. the customer 3463 changed from Cinuos-chel to Schwellbrunn. Also checking the new created customer 4406 contains now the info "4406", "A", "", "Kleinterpraxis Julius Cäsar", "8400", "Winterthur", "Römerstrasse 47", "info@julius-caesar.ch", "D ", "ZH", nil. (But without the e-mail address, which could not be changed)

Also I think this example shows that we cannot recreate customers correctly, as we are missing the organisation field. The fields "Kunden-Nr.","Status","Name1","Name2","PLZ","Ort","Strasse","E-Mail","Sprache","Kanton" from KUNDEN.CSV just don't correspond with the components displayed:

  • organisation
  • customer_id
  • ean13
  • turnover
  • history
  • title
  • drtitle
  • lastname
  • firstname
  • address1
  • address2
  • address3
  • plz
  • city
  • canton
  • email
  • order_confirmation
  • phone_business
  • phone_private
  • phone_mobile
  • fax

Banging my head why the method rename_user(old_name, new_name) in bbmb/util/server.rb (Which uses the BBMB.config.auth_url of "druby://127.0.01:12003") says #<DRb::DRbConnError: DRb::DRbServerNotFound> even when I see the process bbmb 14425 14424 0 15:31 ? 00:00:01 /usr/local/bin/ruby-240 /usr/local/bin/yusd config=/var/www/virbac.bbmb.ch/etc/yus.yml

Logging it at the same time via the HTML works find and in /service/virbac.bbmb.ch-yus/log/main/current I see the lines

@400000005900a145387072bc FEHLER:  Relation »collection« existiert bereits
@400000005900a14628dd3844 I, [2017-04-26T15:31:40.685543 #14425]  INFO -- start: starting yus-server on druby://127.0.0.1:12003
@400000005900a53619d7e204 I, [2017-04-26T15:48:28.433423 #14425]  INFO -- Yus::Server: Login attempt for admin@virbac.ch from ch.bbmb.virbac
@400000005900a53619d9b6c4 I, [2017-04-26T15:48:28.433673 #14425]  INFO -- Yus::Server: Authentication succeeded for admin@virbac.ch
@400000005900a5361afd243c D, [2017-04-26T15:48:28.452759 #14425] DEBUG -- Yus::EntitySession: admin@virbac.ch allowed?(login, ch.bbmb.virbac.Admin) returns true
@400000005900a5361b16d65c D, [2017-04-26T15:48:28.454449 #14425] DEBUG -- Yus::EntitySession: admin@virbac.ch allowed?(login, ch.bbmb.virbac.Customer) returns false
@400000005900a536201bbbf4 D, [2017-04-26T15:48:28.538633 #14425] DEBUG -- Yus::EntitySession: admin@virbac.ch allowed?(edit, yus.entities) returns true

Pushed commit Fix CSV-Importer.

For unknown reasons running sudo -u bbmb /usr/local/bin/ruby231 bin/update_abschluss_artikel_artikel_fr_kunden config=/var/www/virbac.bbmb.ch/etc/config.yml on fastpower is two or three times faster than on my machine. Log see Attach:fastpower_import.txt Δ

Run Drugshortage Update after FI and PI Update

We often got an error

Error: RuntimeError
Message: unable to parse https://www.drugshortage.ch/UebersichtaktuelleLieferengpaesse2.aspx

which we cannot explain. Zeno suspects that the file gets update at the time we are running the import. Therefore we try to run it after the PI/FI update.

Pushed commit Run update_drugshortage as last update

view · edit · sidebar · attach · print · history
Page last modified on April 26, 2017, at 07:04 PM