Sha256: 668472faf50600ef2c175101d7ee57b02367af876954374931f5fad3507ea905

Contents?: true

Size: 611 Bytes

Versions: 4

Compression:

Stored size: 611 Bytes

Contents

class Workflow::User::TasksController < ApplicationController
  before_action :authenticate_user!
  
  def assigned
    @tasks = Task.includes(:story).where(user_id: current_user.id, state: 'assigned')
    projects = Project.where(id: @tasks.map{|t| t.story.project_id }).index_by(&:id)
    products = Product.where(id: projects.values.map(&:product_id)).index_by(&:id)
    
    @tasks.map! do |task|
      project = projects[task.story.project_id]
      project.product = products[project.product_id]
      task.story.project = project
      task
    end
    
    render layout: false if request.xhr?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
voluntary-0.7.1 app/controllers/workflow/user/tasks_controller.rb
voluntary-0.7.0 app/controllers/workflow/user/tasks_controller.rb
voluntary-0.6.0 app/controllers/workflow/user/tasks_controller.rb
voluntary-0.5.2 app/controllers/workflow/user/tasks_controller.rb