diff options
| author | Xinhui | 2017-08-31 17:35:50 +0200 | 
|---|---|---|
| committer | Xinhui | 2017-08-31 17:43:19 +0200 | 
| commit | 732375cb86150cc675e1c61556cd17160e35f564 (patch) | |
| tree | 50a06e9144b2200ee015d228842731b04b839774 /app/models/chouette/route.rb | |
| parent | c7ca08f191733293fc084abadc729cd3c224e120 (diff) | |
| parent | 26c4b71042d258da2fc9ccd67855219b9b012c6b (diff) | |
| download | chouette-core-732375cb86150cc675e1c61556cd17160e35f564.tar.bz2 | |
Merge branch 'master' into stif_netex_objectid
Diffstat (limited to 'app/models/chouette/route.rb')
| -rw-r--r-- | app/models/chouette/route.rb | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb index 81c16f62f..1f59bb7fd 100644 --- a/app/models/chouette/route.rb +++ b/app/models/chouette/route.rb @@ -1,5 +1,6 @@  class Chouette::Route < Chouette::TridentActiveRecord    include RouteRestrictions +  include ChecksumSupport    extend Enumerize    extend ActiveModel::Naming @@ -103,6 +104,14 @@ class Chouette::Route < Chouette::TridentActiveRecord      end    end +  def checksum_attributes +    values = self.slice(*['name', 'published_name', 'wayback']).values +    values.tap do |attrs| +      attrs << self.stop_points.map{|sp| "#{sp.stop_area.user_objectid}#{sp.for_boarding}#{sp.for_alighting}" }.join +      attrs << self.routing_constraint_zones.map(&:checksum) +    end +  end +    def geometry      points = stop_areas.map(&:to_lat_lng).compact.map do |loc|        [loc.lng, loc.lat] | 
