We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 479ffbc + 16b2768 commit 4040ea3Copy full SHA for 4040ea3
lib/redmine_gtt/patches/issue_query_patch.rb
@@ -141,15 +141,15 @@ def find_center_point
141
end
142
143
def distance_query(lng, lat)
144
- "ST_DistanceSphere(#{Issue.table_name}.geom, ST_GeomFromText('POINT(#{lng} #{lat})',4326))"
+ Arel.sql("ST_DistanceSphere(#{Issue.table_name}.geom, ST_GeomFromText('POINT(#{lng.to_f} #{lat.to_f})',4326))")
145
146
147
def load_distances(issues, center_point)
148
lng, lat = center_point
149
distances = Hash[
150
Issue.
151
where(id: issues.map(&:id)).
152
- pluck(:id, Arel.sql("#{distance_query(lng, lat)}"))
+ pluck(:id, distance_query(lng, lat))
153
]
154
issues.each{|i| i.instance_variable_set :@distance, distances[i.id]}
155
0 commit comments