From bdc699d43f2bc92fd36adae96aae482c008097f1 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 14 Jun 2018 10:00:36 +1000 Subject: [PATCH] Add wizard find method --- jobs/set_after_time_wizard.rb | 2 +- lib/wizard.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/jobs/set_after_time_wizard.rb b/jobs/set_after_time_wizard.rb index c911d32d..5d15a831 100644 --- a/jobs/set_after_time_wizard.rb +++ b/jobs/set_after_time_wizard.rb @@ -1,7 +1,7 @@ module Jobs class SetAfterTimeWizard < Jobs::Base def execute(args) - if PluginStoreRow.exists?(plugin_name: 'custom_wizard', key: args[:wizard_id]) + if CustomWizard::Wizard.find(args[:wizard_id]) user_ids = [] User.human_users.each do |u| u.custom_fields['redirect_to_wizard'] = args[:wizard_id] diff --git a/lib/wizard.rb b/lib/wizard.rb index 3567b9e0..953d9f51 100644 --- a/lib/wizard.rb +++ b/lib/wizard.rb @@ -167,6 +167,10 @@ class CustomWizard::Wizard PluginStore.set('custom_wizard', wizard["id"], wizard) end + def self.find(wizard_id) + PluginStoreRow.find_by(plugin_name: 'custom_wizard', key: wizard_id) + end + def self.set_redirect(user, wizard_id, url) PluginStore.set("#{wizard_id.underscore}_submissions", user.id, [{ redirect_to: url }]) end