diff options
| author | Xinhui | 2017-04-13 11:32:11 +0200 |
|---|---|---|
| committer | Xinhui | 2017-04-13 11:32:20 +0200 |
| commit | e96d13ce82e9d9c6aff0468c385979d62ea67e64 (patch) | |
| tree | bba6105e683f087ff4b9fc2461414d7e83405d1b /app | |
| parent | f72dc55a17c0f01bb610bd295038d19bdf95dd3e (diff) | |
| download | chouette-core-e96d13ce82e9d9c6aff0468c385979d62ea67e64.tar.bz2 | |
Update vj time_tables association
refs #3121
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/chouette/vehicle_journey.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb index 0fd2b6af6..27830490f 100644 --- a/app/models/chouette/vehicle_journey.rb +++ b/app/models/chouette/vehicle_journey.rb @@ -91,6 +91,14 @@ module Chouette (times.count == 1 && times[0] == '00:00') ? false : true end + def update_time_tables_from_state item + item['time_tables'].each do |tt| + unless self.time_tables.map(&:id).include?(tt['id']) + self.time_tables << Chouette::TimeTable.find(tt['id']) + end + end + end + def self.state_update route, state transaction do state.each do |item| @@ -103,6 +111,7 @@ module Chouette end vj.update_attributes(state_permited_attributes(item)) + vj.update_time_tables_from_state(item) item['errors'] = vj.errors if vj.errors.any? end |
