view · edit · sidebar · attach · print · history

< Niklaus.20160825-oddb2xml-zip-problem | Index | Niklaus.20160823-bauerfeind-problems >>

20160824-bauerfeind-problems

Summary

  • Some products don't show up correctly after update bauerfeind
  • Fix test to se Pillbox to download zipped transfer.dat
  • Test importing E-Mails for vetoquinol
  • Keep in Mind

Commits

Index

Some products don't show up correctly after update bauerfeind

The importwith my local changes took over 5h to complete. Restarted migeld and ch.oddb services

Looking againg for products:

Search via bin/admin for the root case:

migel> Migel::Model::Product.all.find_all{|x| x.pharmacode.eql? '2244775'}.collect{|x| [x.odba_id, x.pharmacode, x.ean_code, x.migel_code]}
-> [[32437, "2244775", "4046445600104", "05.04.05.00.1"], [3081, "2244775", "4046445107702", "05.04.03.00.1"]]
migel> Migel::Model::Migelid.find_by_migel_code('05.04.03.00.1').products.find_all{|x| x.pharmacode.eql? '2244775'}
-> []
migel> Migel::Model::Migelid.find_by_migel_code('05.04.05.00.1').products.find_all{|x| x.pharmacode.eql? '2244775'}
-> [#<ODBA::Stub:27666240#32437 @odba_class=Migel::Model::Product @odba_container=27482100#3287>]

The old wrong product (odba_id 3081) is still laying around. Corrected the delete loop to find delete this kind of products, too. Improved logging of deleted items to show odba_id, pharmacode, ean_code and migel_code. Reloading the database. Restarting the import. Will check the result once the import has finished.

My preliminary patch see: Attach:delete-bauerfeind.2.txt

The main idea is simple:

  • Iteratate over all MigelIds
    • Iteratate over all products of the choosen migel_code which belong to bauerfeind
      • Call odba_delete for the product
      • Delete the product from the migel_id
  • Iterate over all Products which belong to bauerfeind
    • Call odba_delete for the product
    • Update Database via
    • Migel::Model::Product.all.odba_store
    • Migel::Model::Migelid.all.odba_store

I could see in the importer.rb how Masa handled the case of a product changing its migel_code, as each product belongs to a migelid (as seen in lib/migel/model/product.rb). Also I could not find in the spec test any test case where the migelid of a product is changed. I looked at spec/model/product_spec.rb and spec/util/importer_spec.rb.

The import finished without a problem. After restarting migeld and ch.oddb all searches work as expected! Pushed commit Delete all Bauerfeind products before importing

Fix test to se Pillbox to download zipped transfer.dat

I must adapt the VCR download to return a zipped transfer.dat with the same content as the unzipped file before.

Took me some time to create a new simple zip file for the transfer.dat. Done with the following snippet which reads in a manually zipped transfer.zip

      c.before_record(:zurrose) do |i|
        if /pillbox/i.match(i.request.uri)
          puts "#{Time.now}: #{__LINE__}: URI was #{i.request.uri}"
          tmp_zip = File.join(Oddb2xml::SpecData, 'vcr', 'transfer.zip')
          i.response.body = IO.binread(tmp_zip)
          i.response.headers['Content-Length'] = i.response.body.size
        end
      end

Also returning empty XLSX files when opening an Person/Betrieb XLSX file fails.

Must investigate failures like

 Oddb2xml::Builder when -o for fachinfo is given when -f dat is given should contain the correct values fo CMUT from transfer.dat
      Failure/Error: expect(line[60..65]).to eq '000495'
        expected: "000495"
             got: "000496"

Pushed commit Fixed spec tests. Workaroung for XLSX problem

Test importing E-Mails for vetoquinol

Creating a test for the following https://mail.google.com/mail/u/3/#inbox/156b030e0bf93119. Must test

  • That the email gets separated correctly
  • That the attachements are parsed correctly

Made test for splitting the e-mail. This works fine. Working on reading the articles (plain ascii) and the custormer (ISO-8859-1).

Adding the test for customers showed that I did not strip a leading space when importing from the CSV file. Nice!

Pushed commits:

Working on testing an incoming order. As these mail get dispatched and markes as read, I am unable to retrieve the original mail message as I did for the customer. I see that the TestPopMission has many skip. I think the best way is to convert bbmb to use the gem mail (instead of rmail) and convert all tests accordingly. I think the PopMission is only used by Vetoquinol.

view · edit · sidebar · attach · print · history
Page last modified on August 24, 2016, at 06:20 PM