diff options
| author | Michel Etienne | 2012-11-06 18:53:29 +0100 | 
|---|---|---|
| committer | Michel Etienne | 2012-11-06 18:53:29 +0100 | 
| commit | 48842ac1197560b1b7f597e3e1be7c4d93f8d098 (patch) | |
| tree | dfeee03bf8ae1fb2b4a665b61c95bfe33056105f /app/helpers/access_points_helper.rb | |
| parent | c1c4d3fbc9231fe6b1bdd325faced49f33cdf1b2 (diff) | |
| download | chouette-core-48842ac1197560b1b7f597e3e1be7c4d93f8d098.tar.bz2 | |
add access_points and access_links managment
Diffstat (limited to 'app/helpers/access_points_helper.rb')
| -rw-r--r-- | app/helpers/access_points_helper.rb | 28 | 
1 files changed, 28 insertions, 0 deletions
| diff --git a/app/helpers/access_points_helper.rb b/app/helpers/access_points_helper.rb new file mode 100644 index 000000000..c5e9f672e --- /dev/null +++ b/app/helpers/access_points_helper.rb @@ -0,0 +1,28 @@ +module AccessPointsHelper +  def access_links_pairs(access_links) +    hpairs = Hash.new +    pairs = Array.new +    access_links.each do |link| +      key = pair_key(link) +      pair = nil +      if (hpairs.has_key? key) +        pair = hpairs[key] +      else +        pair = AccessLinkPair.new +        pairs << pair +        hpairs[key] = pair +      end +      if (link.link_orientation_type == "access_point_to_stop_area") +        pair.from_access_point = link +      else +        pair.to_access_point = link +      end +    end +    pairs +  end +   +  def pair_key(access_link) +    "#{access_link.access_point.id}-#{access_link.stop_area.id}" +  end +   +end | 
