diff options
| author | Luc Donnet | 2018-02-27 23:45:02 +0100 |
|---|---|---|
| committer | GitHub | 2018-02-27 23:45:02 +0100 |
| commit | 59761d65be29ce7d1d9c72140e657b994cd28258 (patch) | |
| tree | dc53b6318cc8c3749b77d677798d949c06b32b08 | |
| parent | ccbb8172d1e2463890d4138dae307e5526393cee (diff) | |
| parent | 81329be5b2662706cf32db000adba27d176e44b8 (diff) | |
| download | chouette-core-59761d65be29ce7d1d9c72140e657b994cd28258.tar.bz2 | |
Merge pull request #339 from af83/5878-fix-ComplianceChecksController-show
5878 Add ComplianceCheck#show
| -rw-r--r-- | Gemfile | 1 | ||||
| -rw-r--r-- | Gemfile.lock | 5 | ||||
| -rw-r--r-- | app/controllers/compliance_checks_controller.rb | 5 | ||||
| -rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
| -rw-r--r-- | app/models/compliance_check.rb | 11 | ||||
| -rw-r--r-- | app/models/compliance_control.rb | 44 | ||||
| -rw-r--r-- | app/models/concerns/compliance_item_support.rb | 13 | ||||
| -rw-r--r-- | app/views/compliance_checks/show.html.slim | 13 | ||||
| -rw-r--r-- | app/views/compliance_controls/show.html.slim | 17 | ||||
| -rw-r--r-- | app/views/shared/controls/_metadatas.html.slim | 15 | ||||
| -rw-r--r-- | config/breadcrumbs.rb | 5 | ||||
| -rw-r--r-- | config/locales/compliance_checks.en.yml | 4 | ||||
| -rw-r--r-- | config/locales/compliance_checks.fr.yml | 5 | ||||
| -rw-r--r-- | config/locales/compliance_controls.en.yml | 24 | ||||
| -rw-r--r-- | config/locales/compliance_controls.fr.yml | 22 | ||||
| -rw-r--r-- | db/migrate/20180227151937_add_compliance_control_name_to_compliance_checks.rb | 5 | ||||
| -rw-r--r-- | db/schema.rb | 10 | ||||
| -rw-r--r-- | lib/compliance_control_set_copier.rb | 5 |
18 files changed, 145 insertions, 61 deletions
@@ -135,7 +135,6 @@ gem 'rabl' gem 'carrierwave', '~> 1.0' gem 'sidekiq' -gem 'sinatra' gem 'whenever', github: 'af83/whenever', require: false # '~> 0.9' gem 'rake' gem 'devise-async' diff --git a/Gemfile.lock b/Gemfile.lock index 63d78f9cd..8888549e1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -509,10 +509,6 @@ GEM simplecov-html (0.10.0) simplecov-rcov (0.2.3) simplecov (>= 0.4.1) - sinatra (1.4.8) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) sixarm_ruby_unaccent (1.2.0) slim (3.0.7) temple (~> 0.7.6) @@ -700,7 +696,6 @@ DEPENDENCIES simple_form (~> 3.1.0) simplecov simplecov-rcov - sinatra slim-rails (~> 3.1) spring spring-commands-rspec diff --git a/app/controllers/compliance_checks_controller.rb b/app/controllers/compliance_checks_controller.rb index 81749e292..ad32bc538 100644 --- a/app/controllers/compliance_checks_controller.rb +++ b/app/controllers/compliance_checks_controller.rb @@ -1,4 +1,5 @@ class ComplianceChecksController < InheritedResources::Base - - + belongs_to :workbench do + belongs_to :compliance_check_set + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0058c210d..356c7e69e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -19,7 +19,7 @@ module ApplicationHelper return object.full_name end - local = "#{object.model_name.name.underscore.pluralize}.#{params[:action]}.title" + local = "#{object.model_name.name.underscore.pluralize}.#{params[:action]}.title" if object.try(:name) t(local, name: object.name || object.id) else diff --git a/app/models/compliance_check.rb b/app/models/compliance_check.rb index 55f2ae228..9d817e146 100644 --- a/app/models/compliance_check.rb +++ b/app/models/compliance_check.rb @@ -1,14 +1,23 @@ class ComplianceCheck < ActiveRecord::Base + include ComplianceItemSupport self.inheritance_column = nil extend Enumerize belongs_to :compliance_check_set belongs_to :compliance_check_block - + enumerize :criticity, in: %i(warning error), scope: true, default: :warning validates :criticity, presence: true validates :name, presence: true validates :code, presence: true validates :origin_code, presence: true + + def control_class + compliance_control_name.present? ? compliance_control_name.constantize : nil + end + + delegate :predicate, to: :control_class, allow_nil: true + delegate :prerequisite, to: :control_class, allow_nil: true + end diff --git a/app/models/compliance_control.rb b/app/models/compliance_control.rb index 298a63ab9..537343005 100644 --- a/app/models/compliance_control.rb +++ b/app/models/compliance_control.rb @@ -1,18 +1,16 @@ class ComplianceControl < ActiveRecord::Base + include ComplianceItemSupport class << self def criticities; %i(warning error) end def default_code; "" end - def dynamic_attributes - stored_attributes[:control_attributes] || [] - end def policy_class ComplianceControlPolicy end def subclass_patterns - { + { generic: 'Generic', journey_pattern: 'JourneyPattern', line: 'Line', @@ -30,6 +28,9 @@ class ComplianceControl < ActiveRecord::Base end super end + + def predicate; I18n.t("compliance_controls.#{self.name.underscore}.description") end + def prerequisite; I18n.t("compliance_controls.#{self.name.underscore}.prerequisite") end end extend Enumerize @@ -45,26 +46,25 @@ class ComplianceControl < ActiveRecord::Base validates :compliance_control_set, presence: true validate def coherent_control_set - return true if compliance_control_block_id.nil? - ids = [compliance_control_block.compliance_control_set_id, compliance_control_set_id] - return true if ids.first == ids.last - names = ids.map{|id| ComplianceControlSet.find(id).name} - errors.add(:coherent_control_set, - I18n.t('compliance_controls.errors.incoherent_control_sets', - indirect_set_name: names.first, - direct_set_name: names.last)) -end - + return true if compliance_control_block_id.nil? + ids = [compliance_control_block.compliance_control_set_id, compliance_control_set_id] + return true if ids.first == ids.last + names = ids.map{|id| ComplianceControlSet.find(id).name} + errors.add(:coherent_control_set, + I18n.t('compliance_controls.errors.incoherent_control_sets', + indirect_set_name: names.first, + direct_set_name: names.last)) + end -def initialize(attributes = {}) - super - self.name ||= I18n.t("activerecord.models.#{self.class.name.underscore}.one") - self.code ||= self.class.default_code - self.origin_code ||= self.class.default_code -end + def initialize(attributes = {}) + super + self.name ||= I18n.t("activerecord.models.#{self.class.name.underscore}.one") + self.code ||= self.class.default_code + self.origin_code ||= self.class.default_code + end -def predicate; I18n.t("compliance_controls.#{self.class.name.underscore}.description") end -def prerequisite; I18n.t('compliance_controls.metas.no_prerequisite'); end + def predicate; self.class.predicate end + def prerequisite; self.class.prerequisite end end diff --git a/app/models/concerns/compliance_item_support.rb b/app/models/concerns/compliance_item_support.rb new file mode 100644 index 000000000..f44f5719f --- /dev/null +++ b/app/models/concerns/compliance_item_support.rb @@ -0,0 +1,13 @@ +module ComplianceItemSupport + extend ActiveSupport::Concern + included do + + end + + module ClassMethods + def dynamic_attributes + stored_attributes[:control_attributes] || [] + end + end + +end diff --git a/app/views/compliance_checks/show.html.slim b/app/views/compliance_checks/show.html.slim new file mode 100644 index 000000000..8dd699c65 --- /dev/null +++ b/app/views/compliance_checks/show.html.slim @@ -0,0 +1,13 @@ +- breadcrumb :compliance_check, @workbench, resource +- page_header_content_for resource + + +.page_content + .container-fluid + .row + .col-lg-6.col-md-6.col-sm-12.col-xs-12 + = render partial: "shared/controls/metadatas" + - if resource.compliance_check_block + = definition_list t('compliance_controls.show.metadatas.compliance_check_block'), + I18n.t('activerecord.attributes.compliance_control_blocks.transport_mode') => I18n.t("enumerize.transport_mode.#{resource.compliance_check_block.transport_mode}"), + I18n.t('activerecord.attributes.compliance_control_blocks.transport_submode') => I18n.t("enumerize.transport_submode.#{resource.compliance_check_block.transport_submode}") diff --git a/app/views/compliance_controls/show.html.slim b/app/views/compliance_controls/show.html.slim index ab25747a9..6e7a45d12 100644 --- a/app/views/compliance_controls/show.html.slim +++ b/app/views/compliance_controls/show.html.slim @@ -6,22 +6,7 @@ .container-fluid .row .col-lg-6.col-md-6.col-sm-12.col-xs-12 - /- @compliance_control.control_attributes.each_with_index do |(key,value), index| - = definition_list t('metadatas'), - { \ - ComplianceControl.human_attribute_name(:name) => @compliance_control.name, - ComplianceControl.human_attribute_name(:code) => @compliance_control.code, - ComplianceControl.human_attribute_name(:criticity) => @compliance_control.criticity, - ComplianceControl.human_attribute_name(:comment) => @compliance_control.comment, - I18n.t('activerecord.attributes.compliance_control.predicate') => @compliance_control.predicate, - I18n.t('activerecord.attributes.compliance_control.prerequisite') => @compliance_control.prerequisite, - }.merge( \ - {}.tap do |hash| \ - @compliance_control.class.dynamic_attributes.each do |attribute| \ - hash[ComplianceControl.human_attribute_name(attribute)] = @compliance_control.send(attribute) \ - end \ - end \ - ) + = render partial: "shared/controls/metadatas" - if @compliance_control.compliance_control_block = definition_list t('compliance_controls.show.metadatas.compliance_control_block'), I18n.t('activerecord.attributes.compliance_control_blocks.transport_mode') => I18n.t("enumerize.transport_mode.#{@compliance_control.compliance_control_block.transport_mode}"), diff --git a/app/views/shared/controls/_metadatas.html.slim b/app/views/shared/controls/_metadatas.html.slim new file mode 100644 index 000000000..49df06166 --- /dev/null +++ b/app/views/shared/controls/_metadatas.html.slim @@ -0,0 +1,15 @@ += definition_list t('metadatas'), + { \ + ComplianceControl.human_attribute_name(:name) => resource.name, + ComplianceControl.human_attribute_name(:code) => resource.code, + ComplianceControl.human_attribute_name(:criticity) => resource.criticity, + ComplianceControl.human_attribute_name(:comment) => resource.comment, + I18n.t('activerecord.attributes.compliance_control.predicate') => resource.predicate, + I18n.t('activerecord.attributes.compliance_control.prerequisite') => resource.prerequisite, + }.merge( \ + {}.tap do |hash| \ + resource.class.dynamic_attributes.each do |attribute| \ + hash[ComplianceControl.human_attribute_name(attribute)] = resource.send(attribute) \ + end \ + end \ + ) diff --git a/config/breadcrumbs.rb b/config/breadcrumbs.rb index a7cdb4313..adcbb0b6f 100644 --- a/config/breadcrumbs.rb +++ b/config/breadcrumbs.rb @@ -96,6 +96,11 @@ crumb :compliance_check_set do |workbench, compliance_check_set| parent :compliance_check_sets, workbench end +crumb :compliance_check do |workbench, compliance_check| + link breadcrumb_name(compliance_check), workbench_compliance_check_set_compliance_check_path(workbench, compliance_check.compliance_check_set, compliance_check) + parent :compliance_check_set_executed, workbench, compliance_check.compliance_check_set +end + crumb :compliance_check_set_executed do |workbench, compliance_check_set| link I18n.t('compliance_check_sets.executed.title', name: compliance_check_set.name), executed_workbench_compliance_check_set_path(workbench, compliance_check_set) parent :compliance_check_sets, workbench diff --git a/config/locales/compliance_checks.en.yml b/config/locales/compliance_checks.en.yml index 177c87852..f960755da 100644 --- a/config/locales/compliance_checks.en.yml +++ b/config/locales/compliance_checks.en.yml @@ -8,3 +8,7 @@ en: subclass: Object criticity: Severity name: Name + show: + title: "Compliance check" + metadatas: + compliance_control_block: "Control block informations" diff --git a/config/locales/compliance_checks.fr.yml b/config/locales/compliance_checks.fr.yml index d11d37003..041ab4f43 100644 --- a/config/locales/compliance_checks.fr.yml +++ b/config/locales/compliance_checks.fr.yml @@ -11,4 +11,7 @@ fr: subclass: Objet criticity: Criticité name: Nom - + show: + title: "Consulter un contrôle" + metadatas: + compliance_control_block: "Informations sur le groupe de contrôle" diff --git a/config/locales/compliance_controls.en.yml b/config/locales/compliance_controls.en.yml index ca9d83872..f7d461fdb 100644 --- a/config/locales/compliance_controls.en.yml +++ b/config/locales/compliance_controls.en.yml @@ -29,8 +29,6 @@ en: title: "Add a new compliance control" edit: title: "Update compliance control" - metas: - no_prerequisite: "None" actions: new: Add edit: Edit @@ -41,6 +39,7 @@ en: messages: 3_route_1: "The route with %{source_objectid} objectid connect the stop points %{target_0_label} (%{target_0_objectid}) and %{target_1_label} (%{target_1_objectid}) which belong to the same ZDL" description: "Two stop points which belong to the same ZDL cannot follow one another in a route" + prerequisite: "None" route_control/opposite_route: messages: 3_route_2: "The route with %{source_objectid} objectid references an incoherent oppposite route %{target_0_objectid}" @@ -53,10 +52,12 @@ en: messages: 3_route_3: "The route with %{source_objectid} objectid doesn't have any journey pattern" description: "A route must have at least one journey pattern" + prerequisite: "None" route_control/duplicates: messages: 3_route_4: "The route with %{source_objectid} objectid is identical with another route %{target_0_objectid}" description: "2 routes cannot connect the same stop points with the same order and the same boarding and alighting characteristics" + prerequisite: "None" route_control/opposite_route_terminus: messages: 3_route_5: "The route with %{source_objectid} objectid has a first stop from the %{target_0_label} ZDL whereas its oppoite route's last stop is from the ZDL %{target_1_label}" @@ -66,78 +67,95 @@ en: messages: 3_route_6: "The route with %{source_objectid} objectid does not connect enough stop points (required 2 stop points)" description: "A route must have at least 2 stop points" + prerequisite: "None" route_control/stop_points_in_journey_pattern: messages: 3_route_8: "The stop point %{target_0_label} (%{target_0_objectid}) of the route %{source_objectid} is not used by any journey pattern" description: "The stop points of a route must be used by at least one journey pattern" + prerequisite: "None" route_control/omnibus_journey_pattern: messages: 3_route_9: "The route with %{source_objectid} objectid does not have a journey pattern that connect all of its stop points" description: "A journey pattern of a route should connect all of a route's stop points" + prerequisite: "None" route_control/unactivated_stop_point: messages: 3_route_10: "L'itinéraire %{source_objectid} référence un arrêt (ZDEp) désactivé %{target_0_label} (%{target_0_objectid})" description: "Les arrêts d'un itinéraire ne doivent pas être désactivés" + prerequisite: "None" journey_pattern_control/duplicates: messages: 3_journeypattern_1: "The journey pattern with objectid %{source_objectid} is identical with another one %{target_0_objectid}" description: "Two journey patterns belonging to the same line must not connect the same stop points in the same order" + prerequisite: "None" journey_pattern_control/vehicle_journey: messages: 3_journeypattern_2: "The journey pattern with %{source_objectid} objectid doesn't have any vehicle journey" description: "A journey pattern must have at least one vehicle journey" + prerequisite: "None" vehicle_journey_control/waiting_time: messages: 3_vehiclejourney_1: "On the following vehicle journey %{source_objectid}, the waiting time %{error_value} a this stop point %{target_0_label} (%{target_0_objectid}) is greater than the threshold (%{reference_value})" description: "The waiting time, in minutes, at a specific stop point cannot be too big" + prerequisite: "None" vehicle_journey_control/speed: messages: 3_vehiclejourney_2_1: "On the following vehicle journey %{source_objectid}, the computed speed %{error_value} between the stop points %{target_0_label} (%{target_0_objectid}) and %{target_1_label} (%{target_1_objectid}) is greater than the threshold (%{reference_value})" 3_vehiclejourney_2_2: "On the following vehicle journey %{source_objectid}, the computed speed %{error_value} between the stop points %{target_0_label} (%{target_0_objectid}) and %{target_1_label} (%{target_1_objectid}) is smaller than the threshold (%{reference_value})" description: "The speed between 2 stop points should be confined between thresholds" + prerequisite: "None" vehicle_journey_control/delta: messages: 3_vehiclejourney_3: "The travel time on the vehicle journey with %{source_objectid} objectid between the stop points %{target_0_label} (%{target_0_objectid}) and %{target_1_label} (%{target_1_objectid}) is too far off %{error_value} the average waiting on the journey pattern" description: "The travel time between two following stop points must be close to all the vehicle journey of a journey pattern" + prerequisite: "None" vehicle_journey_control/time_table: messages: 3_vehiclejourney_4: "The vehicle journey with %{source_objectid} objectid does not have a timetable" description: "A vehicle journey must have at least one timetable" + prerequisite: "None" vehicle_journey_control/vehicle_journey_at_stops: messages: 3_vehiclejourney_5_1: "The vehicle journey with %{source_objectid} objectid has an arrival time %{error_value} greater than the departure time %{reference_value} at the stop point %{target_0_label} (%{target_0_objectid})" 3_vehiclejourney_5_2: "The vehicle journey with %{source_objectid} objectid has an departure time %{error_value} at stop point %{target_0_label} (%{target_0_objectid}) greater than the arrival %{reference_value} at the next stop point" description: "The arrival time of a stop point must be smaller than the departure time of this stop point AND the departure time of the stop points must be in chronological order" + prerequisite: "None" routing_constraint_zone_control/vehicle_journey_at_stops: messages: 3_routingconstraint_1: "The Routing Constraint Zone %{source_objectid} references an unactivated stop point (ZDEp) %{target_0_label} (%{target_0_objectid})" description: "The stop points of a Routing Constraint Zone must be activated" + prerequisite: "None" routing_constraint_zone_control/maximum_length: messages: 3_routingconstraint_2: "The Routing Constraint Zone %{source_objectid} covers all the stop points of its related route : %{target_0_objectid}." description: "A Routing Constraint Zone cannot cover all the stop points of a route" + prerequisite: "None" routing_constraint_zone_control/minimum_length: messages: 3_routingconstraint_3: "The Routing Constraint Zone %{source_objectid} has less than 2 stop points" description: "A Routing Constraint Zone must have at least 2 stop points" + prerequisite: "None" line_control/route: messages: 3_line_1: "On line :%{source_label} (%{source_objectid}), no route has an opposite route" description: "The routes of a line must have an opposite route" - prerequisite: Lign has multiple routes + prerequisite: Line has multiple routes generic_attribute_control/pattern: messages: 3_generic_1: "%{source_objectid} : the %{source_attribute} attribute value (%{error_value}) does not respect the following pattern : %{reference_value}" description: "The object attribute must respect a patten (regular expression)" + prerequisite: "None" generic_attribute_control/min_max: messages: 3_generic_2_1: "%{source_objectid} : the %{source_attribute} attributes's value (%{error_value}) is greater than the authorized maximum value : %{reference_value}" 3_generic_2_2: "%{source_objectid} : the %{source_attribute} attributes's value (%{error_value}) is smaller than the authorized minimum value %{reference_value}" description: "The numeric value of an attribute must be contained between 2 values" + prerequisite: "None" generic_attribute_control/uniqueness: messages: 3_generic_3: "%{source_objectid} : the %{source_attribute} attribute (%{error_value}) has a value shared with : %{target_0_objectid}" description: "The attribute's value must be unique compared to the other objects ofthe same type (related to the same line)" + prerequisite: "None" shape_control: 3_shape_1: "Tracé %{source_objectid} : le tracé passe trop loin de l'arrêt %{target_0_label} (%{target_0_objectid}) : %{error_value} > %{reference_value}" 3_shape_2: "Tracé %{source_objectid} : le tracé n'est pas défini entre les arrêts %{target_0_label} (%{target_0_objectid}) et %{target_1_label} (%{target_1_objectid})" diff --git a/config/locales/compliance_controls.fr.yml b/config/locales/compliance_controls.fr.yml index f5f7e351f..44d01a973 100644 --- a/config/locales/compliance_controls.fr.yml +++ b/config/locales/compliance_controls.fr.yml @@ -28,8 +28,6 @@ fr: title: "Editer un contrôle" select_type: title: "Sélectionner un type de contrôle" - metas: - no_prerequisite: "Aucun" actions: new: Ajouter edit: Editer @@ -40,6 +38,7 @@ fr: messages: 3_route_1: "L'itinéraire %{source_objectid} dessert successivement les arrêts %{target_0_label} (%{target_0_objectid}) et %{target_1_label} (%{target_1_objectid}) de la même zone de lieu" description: "Deux arrêts d’une même ZDL ne peuvent pas se succéder dans un itinéraire" + prerequisite: "Aucun" route_control/opposite_route: messages: 3_route_2: "L'itinéraire %{source_objectid} référence un itinéraire retour %{target_0_objectid} incohérent" @@ -52,10 +51,12 @@ fr: messages: 3_route_3: "L'itinéraire %{source_objectid} n'a pas de mission" description: "Un itinéraire doit avoir au moins une mission" + prerequisite: "Aucun" route_control/duplicates: messages: 3_route_4: "L'itinéraire %{source_objectid} est identique à l'itinéraire %{target_0_objectid}" description: "2 itinéraires ne doivent pas desservir strictement les mêmes arrêts dans le même ordre avec les mêmes critères de monté/descente" + prerequisite: "Aucun" route_control/opposite_route_terminus: messages: 3_route_5: "L'itinéraire %{source_objectid} dessert au départ un arrêt de la ZDL %{target_0_label} alors que l'itinéraire inverse dessert à l'arrivée un arrêt de la ZDL %{target_1_label}" @@ -65,60 +66,74 @@ fr: messages: 3_route_6: "L'itinéraire %{source_objectid} ne dessert pas assez d'arrêts (minimum 2 requis)" description: "Un itinéraire doit référencer au moins 2 arrêts" + prerequisite: "Aucun" route_control/stop_points_in_journey_pattern: messages: 3_route_8: "l'arrêt %{target_0_label} (%{target_0_objectid}) de l'itinéraire %{source_objectid} n'est desservi par aucune mission" description: "Les arrêts de l'itinéraire doivent être desservis par au moins une mission" + prerequisite: "Aucun" route_control/omnibus_journey_pattern: messages: 3_route_9: "L'itinéraire %{source_objectid} n'a aucune mission desservant l'ensemble de ses arrêts" description: "Une mission de l'itinéraire devrait desservir l'ensemble des arrêts de celui-ci" + prerequisite: "Aucun" route_control/unactivated_stop_point: messages: 3_route_10: "L'itinéraire %{source_objectid} référence un arrêt (ZDEp) désactivé %{target_0_label} (%{target_0_objectid})" description: "Les arrêts d'un itinéraire ne doivent pas être désactivés" + prerequisite: "Aucun" journey_pattern_control/duplicates: messages: 3_journeypattern_1: "La mission %{source_objectid} est identique à la mission %{target_0_objectid}" description: "Deux missions de la même ligne ne doivent pas desservir les mêmes arrêts dans le même ordre" + prerequisite: "Aucun" journey_pattern_control/vehicle_journey: messages: 3_journeypattern_2: "La mission %{source_objectid} n'a pas de course" description: "Une mission doit avoir au moins une course" + prerequisite: "Aucun" vehicle_journey_control/waiting_time: messages: 3_vehiclejourney_1: "Sur la course %{source_objectid}, le temps d'attente %{error_value} à l'arrêt %{target_0_label} (%{target_0_objectid}) est supérieur au seuil toléré (%{reference_value})" description: "La durée d’attente, en minutes, à un arrêt ne doit pas être trop grande" + prerequisite: "Aucun" vehicle_journey_control/speed: messages: 3_vehiclejourney_2_1: "Sur la course %{source_objectid}, la vitesse calculée %{error_value} entre les arrêts %{target_0_label} (%{target_0_objectid}) et %{target_1_label} (%{target_1_objectid}) est supérieure au seuil toléré (%{reference_value})" 3_vehiclejourney_2_2: "Sur la course %{source_objectid}, la vitesse calculée %{error_value} entre les arrêts %{target_0_label} (%{target_0_objectid}) et %{target_1_label} (%{target_1_objectid}) est inférieure au seuil toléré (%{reference_value})" description: "La vitesse entre deux arrêts doit être dans une fourchette paramétrable" + prerequisite: "Aucun" vehicle_journey_control/delta: messages: 3_vehiclejourney_3: "Le temps de parcours sur la course %{source_objectid} entre les arrêts %{target_0_label} (%{target_0_objectid}) et %{target_1_label} (%{target_1_objectid}) s'écarte de %{error_value} du temps moyen constaté sur la mission" description: "Les temps de parcours entre 2 arrêts successifs doivent être similaires pour toutes les courses d’une même mission" + prerequisite: "Aucun" vehicle_journey_control/time_table: messages: 3_vehiclejourney_4: "La course %{source_objectid} n'a pas de calendrier d'application" description: "Une course doit avoir au moins un calendrier d’application" + prerequisite: "Aucun" vehicle_journey_control/vehicle_journey_at_stops: messages: 3_vehiclejourney_5_1: "La course %{source_objectid} a un horaire d'arrivé %{error_value} supérieur à l'horaire de départ %{reference_value} à l'arrêt %{target_0_label} (%{target_0_objectid})" 3_vehiclejourney_5_2: "La course %{source_objectid} a un horaire de départ %{error_value} à l'arrêt %{target_0_label} (%{target_0_objectid}) supérieur à l'horaire d'arrivé %{reference_value} à l'arrêt suivant" description: "L'horaire d'arrivée à un arrêt doit être antérieur à l'horaire de départ de cet arrêt ET les horaires de départ aux arrêts doivent être dans l'ordre chronologique croissant." + prerequisite: "Aucun" routing_constraint_zone_control/unactivated_stop_point: messages: 3_routingconstraint_1: "L'ITL %{source_objectid} référence un arrêt (ZDEp) désactivé %{target_0_label} (%{target_0_objectid})" description: "Les arrêts d'une ITL ne doivent pas être désactivés" + prerequisite: "Aucun" routing_constraint_zone_control/maximum_length: messages: 3_routingconstraint_2: "L'ITL %{source_objectid} couvre tous les arrêts de l'itinéraire %{target_0_objectid}." description: "Une ITL ne peut pas couvrir l'ensemble des arrêts de l'itinéraire" + prerequisite: "Aucun" routing_constraint_zone_control/minimum_length: messages: 3_routingconstraint_3: "L'ITL %{source_objectid} n'a pas suffisament d'arrêts (minimum 2 arrêts requis)" description: "Une ITL doit référencer au moins 2 arrêts" + prerequisite: "Aucun" line_control/route: messages: 3_line_1: "Sur la ligne %{source_label} (%{source_objectid}), aucun itinéraire n'a d'itinéraire inverse" @@ -128,15 +143,18 @@ fr: messages: 3_generic_1: "%{source_objectid} : l'attribut %{source_attribute} a une valeur %{error_value} qui ne respecte pas le motif %{reference_value}" description: "l'attribut de l'objet doit respecter un motif (expression régulière)" + prerequisite: "Aucun" generic_attribute_control/min_max: messages: 3_generic_2_1: "%{source_objectid} : l'attribut %{source_attribute} a une valeur %{error_value} supérieure à la valeur maximale autorisée %{reference_value}" 3_generic_2_2: "%{source_objectid} : l'attribut %{source_attribute} a une valeur %{error_value} inférieure à la valeur minimale autorisée %{reference_value}" description: "La valeur numérique de l'attribut doit rester comprise entre 2 valeurs" + prerequisite: "Aucun" generic_attribute_control/uniqueness: messages: 3_generic_3: "%{source_objectid} : l'attribut %{source_attribute} a une valeur %{error_value} partagée avec %{target_0_objectid}" description: "La valeur de l'attribut doit être unique au sein des objets de la ligne" + prerequisite: "Aucun" shape_control: 3_shape_1: "Tracé %{source_objectid} : le tracé passe trop loin de l'arrêt %{target_0_label} (%{target_0_objectid}) : %{error_value} > %{reference_value}" 3_shape_2: "Tracé %{source_objectid} : le tracé n'est pas défini entre les arrêts %{target_0_label} (%{target_0_objectid}) et %{target_1_label} (%{target_1_objectid})" diff --git a/db/migrate/20180227151937_add_compliance_control_name_to_compliance_checks.rb b/db/migrate/20180227151937_add_compliance_control_name_to_compliance_checks.rb new file mode 100644 index 000000000..49ab0da11 --- /dev/null +++ b/db/migrate/20180227151937_add_compliance_control_name_to_compliance_checks.rb @@ -0,0 +1,5 @@ +class AddComplianceControlNameToComplianceChecks < ActiveRecord::Migration + def change + add_column :compliance_checks, :compliance_control_name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index c709290f5..045fc658d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,12 +11,12 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180202170009) do +ActiveRecord::Schema.define(version: 20180227151937) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" - enable_extension "hstore" enable_extension "postgis" + enable_extension "hstore" enable_extension "unaccent" create_table "access_links", id: :bigserial, force: :cascade do |t| @@ -90,9 +90,9 @@ ActiveRecord::Schema.define(version: 20180202170009) do t.integer "organisation_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" - t.integer "workgroup_id", limit: 8 t.integer "int_day_types" t.date "excluded_dates", array: true + t.integer "workgroup_id", limit: 8 end add_index "calendars", ["organisation_id"], name: "index_calendars_on_organisation_id", using: :btree @@ -119,7 +119,6 @@ ActiveRecord::Schema.define(version: 20180202170009) do t.datetime "updated_at" t.date "end_date" t.string "date_type" - t.string "mode" end add_index "clean_ups", ["referential_id"], name: "index_clean_ups_on_referential_id", using: :btree @@ -221,6 +220,7 @@ ActiveRecord::Schema.define(version: 20180202170009) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "origin_code" + t.string "compliance_control_name" end add_index "compliance_checks", ["compliance_check_block_id"], name: "index_compliance_checks_on_compliance_check_block_id", using: :btree @@ -421,9 +421,9 @@ ActiveRecord::Schema.define(version: 20180202170009) do t.string "type" t.integer "parent_id", limit: 8 t.string "parent_type" + t.datetime "notified_parent_at" t.integer "current_step", default: 0 t.integer "total_steps", default: 0 - t.datetime "notified_parent_at" t.string "creator" end diff --git a/lib/compliance_control_set_copier.rb b/lib/compliance_control_set_copier.rb index 58d40cdbf..06622f302 100644 --- a/lib/compliance_control_set_copier.rb +++ b/lib/compliance_control_set_copier.rb @@ -21,7 +21,7 @@ class ComplianceControlSetCopier # Workers # ------- def check_organisation_coherence! - return true if cc_set.organisation_id == referential.organisation_id + return true if cc_set.organisation_id == referential.organisation_id raise ArgumentError, "Incoherent organisation of referential" end @@ -66,7 +66,8 @@ class ComplianceControlSetCopier name: name_with_refid(compliance_control.name), comment: compliance_control.comment, code: compliance_control.code, - origin_code: compliance_control.origin_code + origin_code: compliance_control.origin_code, + compliance_control_name: compliance_control.class.name ).tap do | compliance_check | control_id_to_check.update compliance_control.id => compliance_check end |
