Skip to content
This repository
Browse code

Date assignment clarification.

  • Loading branch information...
commit 0133a7d11c9bc7d3a8f4932ede023d112e941a94 1 parent 9d42600
Saulius Grigaliunas authored December 11, 2012
5  app/models/measure.rb
@@ -292,6 +292,7 @@ class Measure < Sequel::Model
292 292
   delegate :related_to_measure_type?, :meursing?, :non_meursing?, :export_refund?, :export_refund_agricultural?, to: :adco_type, prefix: :adco_type, allow_nil: true
293 293
   delegate :quota_order_number_origin_present?, :blank?, to: :quota_order_number, prefix: true, allow_nil: true
294 294
   delegate :base_regulation_not_completely_abrogated?, to: :modification_regulation, prefix: true, allow_nil: true
  295
+  delegate :validity_end_date, to: :goods_nomenclature, prefix: true, allow_nil: true
295 296
 
296 297
   def regulation_is_not_replaced?
297 298
     RegulationReplacement.where(replaced_regulation_id: measure_generating_regulation_id,
@@ -582,6 +583,10 @@ def suspended?
582 583
   def suspending_regulation
583 584
     full_temporary_stop_regulation.presence || measure_partial_temporary_stop
584 585
   end
  586
+
  587
+  def associated_to_non_open_ended_gono?
  588
+    goods_nomenclature.present? && goods_nomenclature.validity_end_date.present?
  589
+  end
585 590
 end
586 591
 
587 592
 
8  lib/chief_transformer/operations/mfcm_delete.rb
@@ -9,7 +9,13 @@ def process
9 9
                .valid_to(record.fe_tsmp)
10 10
                .not_terminated
11 11
                .each do |measure|
12  
-          end_date = (measure.goods_nomenclature.present? && measure.goods_nomenclature.validity_end_date.present? && record.fe_tsmp > measure.goods_nomenclature.validity_end_date) ? measure.goods_nomenclature.validity_end_date : record.fe_tsmp
  12
+          end_date = if (measure.associated_to_non_open_ended_gono? &&
  13
+                         record.fe_tsmp > measure.goods_nomenclature_validity_end_date)
  14
+                       measure.goods_nomenclature_validity_end_date
  15
+                     else
  16
+                       record.fe_tsmp
  17
+                     end
  18
+
13 19
           measure.update validity_end_date: end_date
14 20
         end
15 21
       end

0 notes on commit 0133a7d

Please sign in to comment.
Something went wrong with that request. Please try again.