aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/clean_up.rb
diff options
context:
space:
mode:
authorZog2018-04-18 09:59:15 +0200
committerJohan Van Ryseghem2018-04-27 11:17:19 +0200
commit0046e5a01cb08c10118b01c50f3c52d159854ef0 (patch)
tree6e690461a9266716d31f14611235eab9f1f76e33 /app/models/clean_up.rb
parent681f874e3150c35b03e74b25827b74791ae9ae95 (diff)
downloadchouette-core-0046e5a01cb08c10118b01c50f3c52d159854ef0.tar.bz2
Refs #6572; Use new states
Diffstat (limited to 'app/models/clean_up.rb')
-rw-r--r--app/models/clean_up.rb39
1 files changed, 20 insertions, 19 deletions
diff --git a/app/models/clean_up.rb b/app/models/clean_up.rb
index 761fc47be..ca4f6312b 100644
--- a/app/models/clean_up.rb
+++ b/app/models/clean_up.rb
@@ -24,28 +24,29 @@ class CleanUp < ApplicationModel
def clean
referential.switch
-
- {}.tap do |result|
- if date_type
- processed = send("destroy_time_tables_#{self.date_type}")
- if processed
- result['time_table'] = processed[:time_tables].try(:count)
- result['vehicle_journey'] = processed[:vehicle_journeys].try(:count)
- end
- result['time_table_date'] = send("destroy_time_tables_dates_#{self.date_type}").try(:count)
- result['time_table_period'] = send("destroy_time_tables_periods_#{self.date_type}").try(:count)
- self.overlapping_periods.each do |period|
- exclude_dates_in_overlapping_period(period)
+ referential.pending_while do
+ {}.tap do |result|
+ if date_type
+ processed = send("destroy_time_tables_#{self.date_type}")
+ if processed
+ result['time_table'] = processed[:time_tables].try(:count)
+ result['vehicle_journey'] = processed[:vehicle_journeys].try(:count)
+ end
+ result['time_table_date'] = send("destroy_time_tables_dates_#{self.date_type}").try(:count)
+ result['time_table_period'] = send("destroy_time_tables_periods_#{self.date_type}").try(:count)
+ self.overlapping_periods.each do |period|
+ exclude_dates_in_overlapping_period(period)
+ end
end
- end
- destroy_vehicle_journeys_outside_referential
- # Disabled for the moment. See #5372
- # destroy_time_tables_outside_referential
+ destroy_vehicle_journeys_outside_referential
+ # Disabled for the moment. See #5372
+ # destroy_time_tables_outside_referential
- destroy_vehicle_journeys
- destroy_journey_patterns
- destroy_routes
+ destroy_vehicle_journeys
+ destroy_journey_patterns
+ destroy_routes
+ end
end
end