blob: 23c638964bd11bdaa7550562ac80e565f8adf619 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
namespace :check do
desc "Check routes stop_points positions are valid"
task routes_integrity: :environment do
errors = []
max = Referential.pluck(:name).map(&:size).max + 20
Referential.find_each do |r|
r.switch do
Chouette::Route.find_each do |route|
positions = route.stop_points.pluck(:position)
if positions.size != positions.uniq.size
lb = "Referential: #{r.id}/#{r.name}"
errors << "#{lb + " "*(max-lb.size)} -> Wrong positions in Route #{route.id} : #{positions.inspect} "
end
end
end
end
puts errors.join("\n")
end
end
|