decline submission

This commit is contained in:
Pete Matsyburka
2024-08-21 09:22:59 +03:00
parent 96cf228e74
commit 2764a18252
25 changed files with 439 additions and 28 deletions
+1
View File
@@ -48,6 +48,7 @@ class SubmissionEvent < ApplicationRecord
start_form: 'start_form',
view_form: 'view_form',
complete_form: 'complete_form',
decline_form: 'decline_form',
api_complete_form: 'api_complete_form'
}, scope: false
+5 -2
View File
@@ -6,6 +6,7 @@
#
# id :bigint not null, primary key
# completed_at :datetime
# declined_at :datetime
# email :string
# ip :string
# metadata :text not null
@@ -59,7 +60,9 @@ class Submitter < ApplicationRecord
scope :completed, -> { where.not(completed_at: nil) }
def status
if completed_at?
if declined_at?
'declined'
elsif completed_at?
'completed'
elsif opened_at?
'opened'
@@ -83,6 +86,6 @@ class Submitter < ApplicationRecord
end
def status_event_at
completed_at || opened_at || sent_at || created_at
declined_at || completed_at || opened_at || sent_at || created_at
end
end