Sha256: 69ba97e58cd0e986c5111edee426cca4c0291b90d25b32fba07bad2bf22ae768

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

# Index and show controller for TaskRuns 
# TaskRuns should not be created or edited here because they are generated by rake tasks 
class TrackableTasks::TaskRunsController < ApplicationController
  # Lists all tasks in task run 
  # Defaults to show today's tasks but can also show by week or all time
  def index    
    @task_runs = TrackableTasks::TaskRun.newest_first.by_timeframe(params[:timeframe])

    # Paginate with kaminari if it is installed
    begin
      @task_runs = Kaminari.paginate_array(@task_runs.each).page(params[:page])
      @pagination_enabled = true
    rescue NameError => e
      @pagination_enabled = false
    end
    
    respond_to do |format|
      format.html # index.html.erb
    end
  end

  def stats
    @task_runs = TrackableTasks::TaskRun.newest_first.today
    @today_percentages = TrackableTasks::TaskRun.percentages_by_task_type("today")
    @week_percentages = TrackableTasks::TaskRun.percentages_by_task_type("week")
  end
  
  # Lists specific task run 
  def show
    @task_run = TrackableTasks::TaskRun.find_by_id(params[:id])
    
    
    respond_to do |format|
      format.html # show.html.erb
    end
    
  end
end
  

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trackable_tasks-0.1.3 app/controllers/trackable_tasks/task_runs_controller.rb
trackable_tasks-0.1.2 app/controllers/trackable_tasks/task_runs_controller.rb
trackable_tasks-0.1.1 app/controllers/trackable_tasks/task_runs_controller.rb
trackable_tasks-0.1.0 app/controllers/trackable_tasks/task_runs_controller.rb