mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-01 22:17:49 -05:00
20 lines
403 B
Ruby
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
|