Class: Decidim::Budgets::OrderReminderGenerator
- Inherits:
-
Object
- Object
- Decidim::Budgets::OrderReminderGenerator
- Defined in:
- app/services/decidim/budgets/order_reminder_generator.rb
Overview
This class is the generator class which creates and updates order related reminders, after reminder is generated it is send to user who have not checked out his/her/their vote.
Instance Attribute Summary collapse
-
#reminder_jobs_queued ⇒ Object
readonly
Returns the value of attribute reminder_jobs_queued.
Instance Method Summary collapse
-
#generate ⇒ Object
Creates reminders and updates them if they already exists.
- #generate_for(component, &block) ⇒ Object
-
#initialize ⇒ OrderReminderGenerator
constructor
A new instance of OrderReminderGenerator.
Constructor Details
#initialize ⇒ OrderReminderGenerator
Returns a new instance of OrderReminderGenerator.
10 11 12 13 |
# File 'app/services/decidim/budgets/order_reminder_generator.rb', line 10 def initialize @reminder_manifest = Decidim.reminders_registry.for(:orders) @reminder_jobs_queued = 0 end |
Instance Attribute Details
#reminder_jobs_queued ⇒ Object (readonly)
Returns the value of attribute reminder_jobs_queued.
8 9 10 |
# File 'app/services/decidim/budgets/order_reminder_generator.rb', line 8 def reminder_jobs_queued @reminder_jobs_queued end |
Instance Method Details
#generate ⇒ Object
Creates reminders and updates them if they already exists.
16 17 18 19 20 21 22 |
# File 'app/services/decidim/budgets/order_reminder_generator.rb', line 16 def generate Decidim::Component.where(manifest_name: "budgets").each do |component| next if component.current_settings.votes != "enabled" send_reminders(component) end end |
#generate_for(component, &block) ⇒ Object
24 25 26 27 |
# File 'app/services/decidim/budgets/order_reminder_generator.rb', line 24 def generate_for(component, &block) @alternative_refresh_state = block send_reminders(component) end |