0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00

created method to fetch incomplete submissions

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-07-23 11:35:24 +05:30
Ursprung 911a47db28
Commit 15c65236e7

Datei anzeigen

@ -278,7 +278,7 @@ class CustomWizard::Wizard
def current_submission def current_submission
@current_submission ||= begin @current_submission ||= begin
if submissions.present? if submissions.present?
unsubmitted = submissions.select { |submission| !submission.submitted_at } unsubmitted = unsubmitted_submissions
unsubmitted.present? ? unsubmitted.first : CustomWizard::Submission.new(self) unsubmitted.present? ? unsubmitted.first : CustomWizard::Submission.new(self)
else else
CustomWizard::Submission.new(self) CustomWizard::Submission.new(self)
@ -286,6 +286,10 @@ class CustomWizard::Wizard
end end
end end
def unsubmitted_submissions
submissions&.select { |submission| !submission.submitted_at }
end
def final_cleanup! def final_cleanup!
if id == user.custom_fields['redirect_to_wizard'] if id == user.custom_fields['redirect_to_wizard']
user.custom_fields.delete('redirect_to_wizard') user.custom_fields.delete('redirect_to_wizard')