Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Invalidate all associated national measures.

Commodity#measures returns just actual, still valid measures and we need
to fetch all of them.
  • Loading branch information...
commit 9d42600e2493e9c38ed3f43e4835bbf2ddb3be4a 1 parent 967bbb2
@saulius saulius authored
View
8 lib/tariff_importer/importers/taric_importer/strategies/strategies.rb
@@ -137,7 +137,9 @@ class GoodsNomenclature < BaseStrategy
process(:update) {
goods_nomenclature = klass.filter(self.attributes.slice(*primary_key).symbolize_keys).first
goods_nomenclature.update(self.attributes.except(*primary_key).symbolize_keys)
- goods_nomenclature.measures_dataset.national.non_invalidated.each do |measure|
+ ::Measure.where(goods_nomenclature_sid: goods_nomenclature.goods_nomenclature_sid)
+ .national
+ .non_invalidated.each do |measure|
unless measure.valid?
measure.update invalidated_by: transaction_id,
invalidated_at: Time.now
@@ -148,7 +150,9 @@ class GoodsNomenclature < BaseStrategy
process(:delete) {
goods_nomenclature = klass.filter(self.attributes.slice(*primary_key).symbolize_keys).first
goods_nomenclature.delete
- goods_nomenclature.measures_dataset.national.non_invalidated.each do |measure|
+ ::Measure.where(goods_nomenclature_sid: goods_nomenclature.goods_nomenclature_sid)
+ .national
+ .non_invalidated.each do |measure|
if measure.goods_nomenclature.blank?
measure.update invalidated_by: transaction_id,
invalidated_at: Time.now
Please sign in to comment.
Something went wrong with that request. Please try again.