aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2018-02-27 23:08:48 +0100
committerLuc Donnet2018-02-27 23:08:48 +0100
commitca9fd5d4f09c04875092904f4c1961e3e82b6c3b (patch)
tree3ce0f4bdd4c808c3ab1a2fe0ec0083d75e015c5b
parent0eb57e0a2632563eb1c9b39b3290c378e9b27ed5 (diff)
downloadchouette-core-ca9fd5d4f09c04875092904f4c1961e3e82b6c3b.tar.bz2
Fix prerequisite access for compliance_check and compliance_control Refs #5878 @1
-rw-r--r--app/controllers/compliance_checks_controller.rb5
-rw-r--r--app/models/compliance_check.rb1
-rw-r--r--app/models/compliance_control.rb2
-rw-r--r--app/models/concerns/compliance_item_support.rb2
-rw-r--r--config/breadcrumbs.rb2
-rw-r--r--config/locales/compliance_controls.en.yml24
-rw-r--r--config/locales/compliance_controls.fr.yml22
-rw-r--r--db/schema.rb5
8 files changed, 49 insertions, 14 deletions
diff --git a/app/controllers/compliance_checks_controller.rb b/app/controllers/compliance_checks_controller.rb
index f6659ab9f..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
- belongs_to :compliance_check_set
+ belongs_to :workbench do
+ belongs_to :compliance_check_set
+ end
end
diff --git a/app/models/compliance_check.rb b/app/models/compliance_check.rb
index fda95ea08..9d817e146 100644
--- a/app/models/compliance_check.rb
+++ b/app/models/compliance_check.rb
@@ -18,5 +18,6 @@ class ComplianceCheck < ActiveRecord::Base
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 7cd9ba933..537343005 100644
--- a/app/models/compliance_control.rb
+++ b/app/models/compliance_control.rb
@@ -30,6 +30,7 @@ class ComplianceControl < ActiveRecord::Base
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
@@ -63,6 +64,7 @@ class ComplianceControl < ActiveRecord::Base
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
index 4ec2f130f..f44f5719f 100644
--- a/app/models/concerns/compliance_item_support.rb
+++ b/app/models/concerns/compliance_item_support.rb
@@ -10,6 +10,4 @@ module ComplianceItemSupport
end
end
- def prerequisite; I18n.t('compliance_controls.metas.no_prerequisite'); end
-
end
diff --git a/config/breadcrumbs.rb b/config/breadcrumbs.rb
index d2b205baa..52f22818b 100644
--- a/config/breadcrumbs.rb
+++ b/config/breadcrumbs.rb
@@ -98,7 +98,7 @@ 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, compliance_check.compliance_check_set, workbench
+ parent :compliance_check_set_executed, workbench, compliance_check.compliance_check_set
end
crumb :compliance_check_set_executed do |workbench, compliance_check_set|
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/schema.rb b/db/schema.rb
index 450d2ce5d..045fc658d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -15,10 +15,9 @@ 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"
- enable_extension "objectid"
create_table "access_links", id: :bigserial, force: :cascade do |t|
t.integer "access_point_id", limit: 8
@@ -120,7 +119,6 @@ ActiveRecord::Schema.define(version: 20180227151937) 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
@@ -767,7 +765,6 @@ ActiveRecord::Schema.define(version: 20180227151937) do
t.datetime "created_at"
t.datetime "updated_at"
t.string "objectid_format"
- t.string "registration_number_format"
end
create_table "stop_areas", id: :bigserial, force: :cascade do |t|