Sha256: 73781e545097ccb8b8ff7ed783129dbf75586b8564048558fb6ceea397a84ff9

Contents?: true

Size: 1.09 KB

Versions: 40

Compression:

Stored size: 1.09 KB

Contents

class WelcomeController < ApplicationController
  def index
    flash.keep
    if Task.find_started.size > 0
      redirect_to :controller => 'tasks', :action => :list_started
      return
    end
    if Backlog.count == 0
      redirect_to :controller => 'backlogs', :action => :new
      return
    end
    active_periods = Period.find(:all).select {|period| period.active?(true)}
    my_active_periods = active_periods.select {|period| period.party.includes?(current_user)}
    unless my_active_periods.empty?
      my_active_periods = my_active_periods.sort_by {|p| p.required_speed}
      my_active_periods_required_speed = my_active_periods.map {|p| p.required_speed}
      most_urgent_period = my_active_periods.last
    else
      most_urgent_period = active_periods.sort_by {|p| p.required_speed}.last
    end
    if most_urgent_period
      redirect_to :controller => 'periods', :action => :show, :id => most_urgent_period
      return
    end
    most_urgent_backlog = Backlog.find(:first, :order => :id)
    redirect_to :controller => 'backlogs', :action => :show, :id => most_urgent_backlog.id
  end
  
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
backlog-0.36.2 app/controllers/welcome_controller.rb
backlog-0.17.0 app/controllers/welcome_controller.rb
backlog-0.17.1 app/controllers/welcome_controller.rb
backlog-0.17.2 app/controllers/welcome_controller.rb
backlog-0.17.4 app/controllers/welcome_controller.rb
backlog-0.17.3 app/controllers/welcome_controller.rb
backlog-0.17.5 app/controllers/welcome_controller.rb
backlog-0.18.0 app/controllers/welcome_controller.rb
backlog-0.17.6 app/controllers/welcome_controller.rb
backlog-0.19.0 app/controllers/welcome_controller.rb
backlog-0.20.0 app/controllers/welcome_controller.rb
backlog-0.20.1 app/controllers/welcome_controller.rb
backlog-0.21.0 app/controllers/welcome_controller.rb
backlog-0.21.2 app/controllers/welcome_controller.rb
backlog-0.21.1 app/controllers/welcome_controller.rb
backlog-0.21.3 app/controllers/welcome_controller.rb
backlog-0.22.1 app/controllers/welcome_controller.rb
backlog-0.22.0 app/controllers/welcome_controller.rb
backlog-0.23.0 app/controllers/welcome_controller.rb
backlog-0.23.1 app/controllers/welcome_controller.rb