add archived filter

This commit is contained in:
Pete Matsyburka
2025-04-01 10:12:54 +03:00
parent e5db61e358
commit dd559e90f1
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -64,6 +64,7 @@ class Submission < ApplicationRecord
through: :template, source: :documents_attachments
scope :active, -> { where(archived_at: nil) }
scope :archived, -> { where.not(archived_at: nil) }
scope :pending, -> { joins(:submitters).where(submitters: { completed_at: nil }).group(:id) }
scope :completed, lambda {
where.not(Submitter.where(Submitter.arel_table[:submission_id].eq(Submission.arel_table[:id])