Actually count and show the active projects/tasks in the overview

This commit is contained in:
Paul van Tilburg 2015-07-11 21:29:35 +02:00
parent 23af29b800
commit 5160e79953
1 changed files with 4 additions and 1 deletions

View File

@ -905,6 +905,7 @@ module StopTime::Controllers
@tasks = {} @tasks = {}
@task_count = 0 @task_count = 0
@active_tasks = {} @active_tasks = {}
@active_task_count = 0
@active_tasks_summary = {} @active_tasks_summary = {}
@totals = [0.0, 0,0] @totals = [0.0, 0,0]
Customer.all.each do |customer| Customer.all.each do |customer|
@ -913,6 +914,7 @@ module StopTime::Controllers
@task_count += tasks.count @task_count += tasks.count
active_tasks = customer.active_tasks active_tasks = customer.active_tasks
@active_tasks[customer] = active_tasks @active_tasks[customer] = active_tasks
@active_task_count += active_tasks.count
@active_tasks_summary[customer] = @active_tasks_summary[customer] =
active_tasks.inject([0.0, 0.0]) do |summ, task| active_tasks.inject([0.0, 0.0]) do |summ, task|
task_summ = task.summary task_summ = task.summary
@ -1800,7 +1802,8 @@ module StopTime::Views
header.page_header do header.page_header do
h1 do h1 do
text! "Overview" text! "Overview"
small "#{@tasks.count} customers, #{@task_count} active projects/tasks" small "#{@tasks.count} customers, " +
"#{@active_task_count} active projects/tasks"
end end
end end
if @tasks.empty? if @tasks.empty?