mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-02-02 13:41:00 -05:00
Can't calculate first harvest if there are no harvests
This commit is contained in:
@@ -114,6 +114,7 @@ class Planting < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def update_harvest_days
|
||||
return unless harvests.size.positive?
|
||||
# how long ago was this planted
|
||||
first_harvest = (harvests.first.harvested_at - planted_at).to_i
|
||||
last_harvest = finished? ? (harvests.last.harvested_at - planted_at).to_i : nil
|
||||
|
||||
Reference in New Issue
Block a user