From 1916335fa901dd203587825d5c2ca1744a0b2655 Mon Sep 17 00:00:00 2001 From: Faizaan Gagan Date: Mon, 23 Aug 2021 03:00:14 +0530 Subject: [PATCH] FIX: use class method as alias for instance method --- lib/custom_wizard/submission.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/custom_wizard/submission.rb b/lib/custom_wizard/submission.rb index de33e817..f64e90ba 100644 --- a/lib/custom_wizard/submission.rb +++ b/lib/custom_wizard/submission.rb @@ -98,20 +98,20 @@ class CustomWizard::Submission end def self.remove(submission) - if submission.present? - user_id = submission.user.id - wizard_id = submission.wizard.id - submission_id = submission.id + submission.remove + end + + def remove + if present? + user_id = @user.id + wizard_id = @wizard.id + submission_id = @id data = PluginStore.get("#{wizard_id}_#{KEY}", user_id) data.delete_if { |sub| sub["id"] == submission_id } PluginStore.set("#{wizard_id}_#{KEY}", user_id, data) end end - def remove - self.class.remove(self) - end - def self.cleanup_incomplete_submissions(wizard) user_id = wizard.user.id all_submissions = list(wizard, user_id: user_id)