Class: Decidim::TimeTracker::Admin::ExportTimeTracker

Inherits:
Rectify::Command
  • Object
show all
Defined in:
app/commands/decidim/time_tracker/admin/export_time_tracker.rb

Overview

A command with all the business logic when an admin exports time tracker to create an accountability component.

Instance Method Summary collapse

Constructor Details

#initialize(current_component, current_user) ⇒ ExportTimeTracker

Public: Initializes the command.



10
11
12
13
# File 'app/commands/decidim/time_tracker/admin/export_time_tracker.rb', line 10

def initialize(current_component, current_user)
  @component = current_component
  @user = current_user
end

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid when we couldn’t proceed.

Returns the accountability component.



21
22
23
24
25
# File 'app/commands/decidim/time_tracker/admin/export_time_tracker.rb', line 21

def call
  create_component
  export_time_tracker
  broadcast(:ok, @accountability_component)
end