diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/hearth.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/hearth.rb b/app/models/hearth.rb index 5d244ec..1bd54a5 100644 --- a/app/models/hearth.rb +++ b/app/models/hearth.rb @@ -9,4 +9,10 @@ class Hearth < ApplicationRecord return false unless bhi bhi.level >= level end + + def amenity_level(hearth_amenity) + hearth_amenity = HearthAmenity.find_by_gid(hearth_amenity) if hearth_amenity.is_a? String + bhi = self.built_hearth_amenities.find_by(hearth_amenity: hearth_amenity) + bhi ? bhi.level : 0 + end end |