2024-09-04 00:37:45 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Reviewable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2024-09-20 17:51:37 +09:00
|
|
|
included do
|
|
|
|
scope :reviewed, -> { where.not(reviewed_at: nil) }
|
|
|
|
scope :unreviewed, -> { where(reviewed_at: nil) }
|
|
|
|
end
|
|
|
|
|
2024-09-04 00:37:45 +09:00
|
|
|
def requires_review?
|
|
|
|
reviewed_at.nil?
|
|
|
|
end
|
|
|
|
|
|
|
|
def reviewed?
|
|
|
|
reviewed_at.present?
|
|
|
|
end
|
|
|
|
|
|
|
|
def requested_review?
|
|
|
|
requested_review_at.present?
|
|
|
|
end
|
|
|
|
|
|
|
|
def requires_review_notification?
|
|
|
|
requires_review? && !requested_review?
|
|
|
|
end
|
|
|
|
end
|