diff options
| author | Luc Donnet | 2017-10-04 13:17:41 +0200 |
|---|---|---|
| committer | Luc Donnet | 2017-10-04 13:18:45 +0200 |
| commit | 7927a067f575c40a7ab7712485cf37c0f3356ad2 (patch) | |
| tree | 57db671df7168234ef3f1cd12674ec7d1f24b470 | |
| parent | 383a0d823ebf875baa08f77ccb0eb8a0f06b866e (diff) | |
| download | chouette-core-7927a067f575c40a7ab7712485cf37c0f3356ad2.tar.bz2 | |
Rename app/models/route_control/speed.rb -> app/models/vehicle_journey_control/speed.rb and fix variables name in compliance control subclasses Refs #4690
| -rw-r--r-- | app/models/compliance_control.rb | 4 | ||||
| -rw-r--r-- | app/models/generic_attribute_control/min_max.rb | 3 | ||||
| -rw-r--r-- | app/models/generic_attribute_control/pattern.rb | 3 | ||||
| -rw-r--r-- | app/models/generic_attribute_control/uniqueness.rb | 3 | ||||
| -rw-r--r-- | app/models/vehicle_journey_control/delta.rb | 2 | ||||
| -rw-r--r-- | app/models/vehicle_journey_control/speed.rb (renamed from app/models/route_control/speed.rb) | 3 | ||||
| -rw-r--r-- | app/models/vehicle_journey_control/waiting_time.rb | 1 | ||||
| -rw-r--r-- | config/initializers/apartment.rb | 2 | ||||
| -rw-r--r-- | spec/factories/compliance_controls/route_control_factories.rb | 4 | ||||
| -rw-r--r-- | spec/factories/compliance_controls/vehicle_journey_control_factories.rb | 4 |
10 files changed, 16 insertions, 13 deletions
diff --git a/app/models/compliance_control.rb b/app/models/compliance_control.rb index e859aaba0..33a075e40 100644 --- a/app/models/compliance_control.rb +++ b/app/models/compliance_control.rb @@ -3,7 +3,7 @@ class ComplianceControl < ActiveRecord::Base belongs_to :compliance_control_set belongs_to :compliance_control_block - enumerize :criticity, in: %i(info warning error), scope: true, default: :info + enumerize :criticity, in: %i(warning error), scope: true, default: :warning hstore_accessor :control_attributes, {} validates :criticity, presence: true @@ -55,7 +55,6 @@ require_dependency 'route_control/minimum_length' require_dependency 'route_control/omnibus_journey_pattern' require_dependency 'route_control/opposite_route_terminus' require_dependency 'route_control/opposite_route' -require_dependency 'route_control/speed' require_dependency 'route_control/stop_points_in_journey_pattern' require_dependency 'route_control/time_table' require_dependency 'route_control/unactivated_stop_points' @@ -66,3 +65,4 @@ require_dependency 'routing_constraint_zone_control/minimum_length' require_dependency 'routing_constraint_zone_control/unactivated_stop_point' require_dependency 'vehicle_journey_control/delta' require_dependency 'vehicle_journey_control/waiting_time' +require_dependency 'vehicle_journey_control/speed' diff --git a/app/models/generic_attribute_control/min_max.rb b/app/models/generic_attribute_control/min_max.rb index 452d1d889..876f56eed 100644 --- a/app/models/generic_attribute_control/min_max.rb +++ b/app/models/generic_attribute_control/min_max.rb @@ -1,6 +1,6 @@ module GenericAttributeControl class MinMax < ComplianceControl - hstore_accessor :control_attributes, minimum: :integer, maximum: :integer + hstore_accessor :control_attributes, minimum: :integer, maximum: :integer, target: :string validate :min_max_values def min_max_values @@ -8,6 +8,7 @@ module GenericAttributeControl end class << self + def attribute_type; :integer end def default_criticity; :warning end def default_code; "3-Generic-2" end end diff --git a/app/models/generic_attribute_control/pattern.rb b/app/models/generic_attribute_control/pattern.rb index 72bb1770a..6796da84f 100644 --- a/app/models/generic_attribute_control/pattern.rb +++ b/app/models/generic_attribute_control/pattern.rb @@ -1,6 +1,6 @@ module GenericAttributeControl class Pattern < ComplianceControl - hstore_accessor :control_attributes, value: :string, pattern: :string + hstore_accessor :control_attributes, pattern: :string, target: :string validate :pattern_match def pattern_match @@ -8,6 +8,7 @@ module GenericAttributeControl end class << self + def attribute_type; :string end def default_criticity; :warning end def default_code; "3-Generic-3" end end diff --git a/app/models/generic_attribute_control/uniqueness.rb b/app/models/generic_attribute_control/uniqueness.rb index 6ffe78565..f227bf8b6 100644 --- a/app/models/generic_attribute_control/uniqueness.rb +++ b/app/models/generic_attribute_control/uniqueness.rb @@ -1,6 +1,6 @@ module GenericAttributeControl class Uniqueness < ComplianceControl - hstore_accessor :control_attributes, name: :string + hstore_accessor :control_attributes, target: :string validate :unique_values def unique_values @@ -8,6 +8,7 @@ module GenericAttributeControl end class << self + def attribute_type; :string end def default_criticity; :warning end def default_code; "3-Generic-3" end end diff --git a/app/models/vehicle_journey_control/delta.rb b/app/models/vehicle_journey_control/delta.rb index 797072fdd..7be0db261 100644 --- a/app/models/vehicle_journey_control/delta.rb +++ b/app/models/vehicle_journey_control/delta.rb @@ -1,7 +1,7 @@ module VehicleJourneyControl class Delta < ComplianceControl - hstore_accessor :control_attributes, delta: :integer + hstore_accessor :control_attributes, maximum: :integer def self.default_code; "3-VehicleJourney-3" end end diff --git a/app/models/route_control/speed.rb b/app/models/vehicle_journey_control/speed.rb index d5798d153..cc46ee1f9 100644 --- a/app/models/route_control/speed.rb +++ b/app/models/vehicle_journey_control/speed.rb @@ -1,6 +1,5 @@ -module RouteControl +module VehicleJourneyControl class Speed < ComplianceControl - hstore_accessor :control_attributes, minimum: :integer, maximum: :integer def self.default_code; "3-VehicleJourney-2" end diff --git a/app/models/vehicle_journey_control/waiting_time.rb b/app/models/vehicle_journey_control/waiting_time.rb index 614f401bb..da35bc4a1 100644 --- a/app/models/vehicle_journey_control/waiting_time.rb +++ b/app/models/vehicle_journey_control/waiting_time.rb @@ -1,5 +1,6 @@ module VehicleJourneyControl class WaitingTime < ComplianceControl + hstore_accessor :control_attributes, maximum: :integer def self.default_code; "3-VehicleJourney-1" end end diff --git a/config/initializers/apartment.rb b/config/initializers/apartment.rb index ade871138..9954c9b3e 100644 --- a/config/initializers/apartment.rb +++ b/config/initializers/apartment.rb @@ -61,7 +61,6 @@ Apartment.configure do |config| 'RouteControl::OmnibusJourneyPattern', 'RouteControl::OppositeRouteTerminus', 'RouteControl::OppositeRoute', - 'RouteControl::Speed', 'RouteControl::StopPointsInJourneyPattern', 'RouteControl::TimeTable', 'RouteControl::UnactivatedStopPoints', @@ -72,6 +71,7 @@ Apartment.configure do |config| 'RoutingConstraintZoneControl::UnactivatedStopPoint', 'VehicleJourneyControl::Delta', 'VehicleJourneyControl::WaitingTime', + 'VehicleJourneyControl::Speed', 'ComplianceControlSet', 'ComplianceControlBlock', 'ComplianceCheck', diff --git a/spec/factories/compliance_controls/route_control_factories.rb b/spec/factories/compliance_controls/route_control_factories.rb index 654a67b46..763a197ee 100644 --- a/spec/factories/compliance_controls/route_control_factories.rb +++ b/spec/factories/compliance_controls/route_control_factories.rb @@ -36,10 +36,6 @@ FactoryGirl.define do association :compliance_control_set end - factory :route_control_speed, class: 'RouteControl::Speed' do - association :compliance_control_set - end - factory :route_control_time_table, class: 'RouteControl::TimeTable' do association :compliance_control_set end diff --git a/spec/factories/compliance_controls/vehicle_journey_control_factories.rb b/spec/factories/compliance_controls/vehicle_journey_control_factories.rb index 3871f80a5..3775624db 100644 --- a/spec/factories/compliance_controls/vehicle_journey_control_factories.rb +++ b/spec/factories/compliance_controls/vehicle_journey_control_factories.rb @@ -7,4 +7,8 @@ FactoryGirl.define do factory :vehicle_journey_control_delta, class: 'VehicleJourneyControl::Delta' do association :compliance_control_set end + + factory :vehicle_journey_control_speed, class: 'VehicleJourneyControl::Speed' do + association :compliance_control_set + end end |
