Skip to content

Commit

Permalink
Reverse map refresh bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sashadev-sky authored Jun 8, 2019
1 parent 03deef1 commit f523a92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,16 @@ def average_cm_per_pixel
if !warpables.empty?
scales = []
count = 0
average = 0
placed_warpables.each do |warpable|
count += 1
res = warpable.cm_per_pixel
res = 1 if res.zero? # let's not ever try to go for infinite resolution
scales << res unless res.nil?
end
total_sum = (scales.inject { |sum, n| sum + n }) if scales
return total_sum / count if total_sum
average = total_sum/count if total_sum
average
else
0
end
Expand Down

0 comments on commit f523a92

Please sign in to comment.