Skip to content

Commit

Permalink
Fix area calculation.
Browse files Browse the repository at this point in the history
We need to continue to use the features method in area_in_square_meters since we are dealing with an ActiveRecord::Relation. We only want to use the aggregate_feature model for the instance method.
  • Loading branch information
rywall committed Jun 23, 2021
1 parent 2b6c8b4 commit 99ae9a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/spatial_features/has_spatial_features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def has_features_area?
end

def area_in_square_meters
aggregate_feature.area
features.area
end

private
Expand Down Expand Up @@ -208,7 +208,7 @@ def total_intersection_area_percentage(klass)
end

def features_area_in_square_meters
@features_area_in_square_meters ||= features.area
@features_area_in_square_meters ||= aggregate_feature.area
end

def total_intersection_area_in_square_meters(other)
Expand Down

0 comments on commit 99ae9a6

Please sign in to comment.