oddb2xml 2.9.4 → 2.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a07febba3dbb4717920c6c45c42307b8454f5492cbeb198f4812e68f98e06b3
4
- data.tar.gz: e2a3a7c28d1563d76bea00b95083615060e2430438abe34e3bed593cdf903559
3
+ metadata.gz: 81e52658848bb173c8567f2b0b5d0c0602174df59c3dae92d684b610cf2bd24f
4
+ data.tar.gz: 481933787eca6b97b4cf62e6f82cf6a8fbc1ed7c5fb919fd744e01cdddd67dac
5
5
  SHA512:
6
- metadata.gz: 9de3798d92b1b2437b1cc2f395dc51a886d8bf5b7aca502cc19ec915a507ebd6258dacdb2cc38db10fa27a7b9e666648565d4d855e3aa54c32daedd5ade576cc
7
- data.tar.gz: c5e4cd7e0e05111c2a3e04d957a166982743e0ab93a0d1d59b5eb76b6fcba5154c6d6da259f6e4f14eba764f8a256a3cc31a83713c6b72536a34ebae25c1b4c9
6
+ metadata.gz: 10eecf8efc056b0b5f921aa9da9e05b8f97711b0e75815a2d5e4ccd5a1984a8552634198b9e59eb68d41001bd89c3dc2cddf160e12d9b1de3880b103976bdfa1
7
+ data.tar.gz: 86e7f32498ecea679340177b6ac458dc023dc9242b9cb5dc5ea0d2ba1d5c7a7d97f0b75615848a4c8ffba7c474615ddadcf0f3e41c0739bdf5e30c66f2e24052
@@ -605,6 +605,7 @@ module Oddb2xml
605
605
  add_missing_products_from_swissmedic
606
606
  add_products_from_bag_preparations(true)
607
607
  nbr_products = 0
608
+ added_gtin = Set.new
608
609
  Oddb2xml.log "build_product #{@products.size + @missing.size} products"
609
610
  a_builder = Nokogiri::XML::Builder.new(encoding: "utf-8") do |xml|
610
611
  xml.doc.tag_suffix = @tag_suffix
@@ -614,6 +615,7 @@ module Oddb2xml
614
615
  ean = obj[:ean13]
615
616
  next unless check_name(obj, :de)
616
617
  next unless check_name(obj, :fr)
618
+ next if added_gtin.include?(ean)
617
619
  next if /^Q/i.match?(obj[:atc])
618
620
  if obj[:prodno]
619
621
  next if emitted.index(obj[:prodno])
@@ -634,26 +636,14 @@ module Oddb2xml
634
636
  xml.CompositionSwissmedic obj[:composition_swissmedic] if obj[:composition_swissmedic]
635
637
  }
636
638
  end
637
- @firstbase.each do |ean13, obj|
638
- description = obj[:trade_item_description_de]
639
- if description.empty?
640
- description = obj[:trade_item_description_en]
641
- end
642
- if !description.empty? || !obj[:trade_item_description_fr].empty?
643
- xml.PRD("DT" => "") {
644
- xml.GTIN obj[:gtin]
645
- xml.CPT
646
- xml.DSCRD description
647
- xml.DSCRF obj[:trade_item_description_fr]
648
- }
649
- end
650
- end
651
639
  @products.sort.to_h.each do |ean13, obj|
652
640
  next if /^Q/i.match?(obj[:atc])
653
641
  seq = obj[:seq]
654
642
  ean = obj[:ean13]
655
643
  next unless check_name(obj, :de)
656
644
  next unless check_name(obj, :fr)
645
+ next if added_gtin.include?(ean)
646
+ added_gtin.add(ean)
657
647
  xml.PRD("DT" => obj[:last_change]) do
658
648
  nbr_products += 1
659
649
  xml.GTIN ean
@@ -766,6 +756,22 @@ module Oddb2xml
766
756
  xml.CompositionSwissmedic obj[:comp] unless obj[:comp].empty?
767
757
  end
768
758
  end
759
+ @firstbase.each do |ean13, obj|
760
+ description = obj[:trade_item_description_de]
761
+ if description.empty?
762
+ description = obj[:trade_item_description_en]
763
+ end
764
+ next if added_gtin.include?(obj[:gtin])
765
+ if !description.empty? || !obj[:trade_item_description_fr].empty?
766
+ added_gtin.add(obj[:gtin])
767
+ xml.PRD("DT" => "") {
768
+ xml.GTIN obj[:gtin]
769
+ xml.CPT
770
+ xml.DSCRD description
771
+ xml.DSCRF obj[:trade_item_description_fr]
772
+ }
773
+ end
774
+ end
769
775
  xml.RESULT {
770
776
  xml.OK_ERROR "OK"
771
777
  xml.NBR_RECORD nbr_products
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "2.9.4"
2
+ VERSION = "2.9.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oddb2xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.4
4
+ version: 2.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-08 00:00:00.000000000 Z
11
+ date: 2024-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip