|
|
|
|
@ -78,8 +78,9 @@ class Submission < ApplicationRecord
|
|
|
|
|
scope :active, -> { where(archived_at: nil) }
|
|
|
|
|
scope :archived, -> { where.not(archived_at: nil) }
|
|
|
|
|
scope :pending, lambda {
|
|
|
|
|
where(Submitter.where(Submitter.arel_table[:submission_id].eq(Submission.arel_table[:id])
|
|
|
|
|
.and(Submitter.arel_table[:completed_at].eq(nil))).select(1).arel.exists)
|
|
|
|
|
where(expire_at: nil).or(where(expire_at: Time.current..))
|
|
|
|
|
.where(Submitter.where(Submitter.arel_table[:submission_id].eq(Submission.arel_table[:id])
|
|
|
|
|
.and(Submitter.arel_table[:completed_at].eq(nil))).select(1).arel.exists)
|
|
|
|
|
}
|
|
|
|
|
scope :completed, lambda {
|
|
|
|
|
where.not(Submitter.where(Submitter.arel_table[:submission_id].eq(Submission.arel_table[:id])
|
|
|
|
|
|