aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcedricnjanga2017-11-22 12:30:38 +0100
committercedricnjanga2017-11-22 14:05:05 +0100
commitf7b9b6ad5280179367c225e1d35d123bad67dcaf (patch)
tree38e53dc036c42eaa2a7671200c1a0740d2d1dd86
parent9304f16e56c219fd63fa12b7d42a7cbf16b2914a (diff)
downloadchouette-core-f7b9b6ad5280179367c225e1d35d123bad67dcaf.tar.bz2
Fix last spec and add short_id method to Netex Objectid
-rw-r--r--app/models/chouette/journey_pattern.rb2
-rw-r--r--app/models/chouette/objectid/netex.rb2
-rw-r--r--app/models/chouette/objectid/stif_codifligne.rb4
-rw-r--r--app/models/chouette/objectid/stif_reflex.rb4
-rw-r--r--db/schema.rb4
-rw-r--r--spec/helpers/table_builder_helper_spec.rb8
6 files changed, 15 insertions, 9 deletions
diff --git a/app/models/chouette/journey_pattern.rb b/app/models/chouette/journey_pattern.rb
index 797b6adb1..c1f9fb4f8 100644
--- a/app/models/chouette/journey_pattern.rb
+++ b/app/models/chouette/journey_pattern.rb
@@ -11,8 +11,6 @@ module Chouette
has_many :vehicle_journey_at_stops, :through => :vehicle_journeys
has_and_belongs_to_many :stop_points, -> { order("stop_points.position") }, :before_add => :vjas_add, :before_remove => :vjas_remove, :after_add => :shortcuts_update_for_add, :after_remove => :shortcuts_update_for_remove
has_many :stop_areas, through: :stop_points
- has_many :journey_pattern_sections
- has_many :route_sections, through: :journey_pattern_sections, dependent: :destroy
validates_presence_of :route
validates_presence_of :name
diff --git a/app/models/chouette/objectid/netex.rb b/app/models/chouette/objectid/netex.rb
index 7953c6b12..57415ac98 100644
--- a/app/models/chouette/objectid/netex.rb
+++ b/app/models/chouette/objectid/netex.rb
@@ -26,7 +26,7 @@ module Chouette
end
def short_id
- local_id
+ local_id.try(:split, "-").try(:first)
end
end
end
diff --git a/app/models/chouette/objectid/stif_codifligne.rb b/app/models/chouette/objectid/stif_codifligne.rb
index a1e40f0a1..903ebc2dc 100644
--- a/app/models/chouette/objectid/stif_codifligne.rb
+++ b/app/models/chouette/objectid/stif_codifligne.rb
@@ -19,6 +19,10 @@ module Chouette
def to_s
"#{self.provider_id}:#{self.sync_id}:#{self.object_type}:#{self.local_id}"
end
+
+ def short_id
+ local_id
+ end
end
end
end \ No newline at end of file
diff --git a/app/models/chouette/objectid/stif_reflex.rb b/app/models/chouette/objectid/stif_reflex.rb
index 69a3f52fa..cd0f62298 100644
--- a/app/models/chouette/objectid/stif_reflex.rb
+++ b/app/models/chouette/objectid/stif_reflex.rb
@@ -18,6 +18,10 @@ module Chouette
def to_s
"#{self.country_code}:#{self.zip_code}:#{self.object_type}:#{self.local_id}:#{self.provider_id}"
end
+
+ def short_id
+ local_id
+ end
end
end
end \ No newline at end of file
diff --git a/db/schema.rb b/db/schema.rb
index 830e3ca25..21aa73cd8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20171109101605) do
+ActiveRecord::Schema.define(version: 20171114102438) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -408,9 +408,9 @@ ActiveRecord::Schema.define(version: 20171109101605) 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/spec/helpers/table_builder_helper_spec.rb b/spec/helpers/table_builder_helper_spec.rb
index de81a85af..3b0a18379 100644
--- a/spec/helpers/table_builder_helper_spec.rb
+++ b/spec/helpers/table_builder_helper_spec.rb
@@ -37,7 +37,7 @@ describe TableBuilderHelper, type: :helper do
referentials = ModelDecorator.decorate(
referentials,
- with: Chouette::ReferentialDecorator
+ with: ReferentialDecorator
)
expected = <<-HTML
@@ -214,7 +214,7 @@ describe TableBuilderHelper, type: :helper do
</thead>
<tbody>
<tr>
- <td>#{company.objectid.local_id}</td>
+ <td>#{company.get_objectid.local_id}</td>
<td title="Voir"><a href="/referentials/#{referential.id}/companies/#{company.id}">#{company.name}</a></td>
<td></td>
<td></td>
@@ -237,7 +237,7 @@ describe TableBuilderHelper, type: :helper do
[
TableBuilderHelper::Column.new(
name: 'ID Codif',
- attribute: Proc.new { |n| n.try(:objectid).try(:local_id) },
+ attribute: Proc.new { |n| n.try(:get_objectid).try(:local_id) },
sortable: false
),
TableBuilderHelper::Column.new(
@@ -350,7 +350,7 @@ describe TableBuilderHelper, type: :helper do
[
TableBuilderHelper::Column.new(
name: 'ID Codif',
- attribute: Proc.new { |n| n.try(:objectid).try(:local_id) }
+ attribute: Proc.new { |n| n.try(:get_objectid).try(:local_id) }
),
TableBuilderHelper::Column.new(
key: :name,