Files
growstuff/app/models/concerns/finishable.rb
google-labs-jules[bot] ba6ec689c5 Merge pull request #4150 from Growstuff/feature/failed-plantings
Add failed status to plantings
2025-08-27 23:42:53 +09:30

20 lines
403 B
Ruby

# frozen_string_literal: true
module Finishable
extend ActiveSupport::Concern
included do
scope :finished, -> { where(finished: true) }
scope :current, -> { where.not(finished: true) }
def active
# Plantings can fail. At the moment, activities and seeds cannot.
if respond_to?(:failed)
!finished && !failed
else
!finished
end
end
end
end