From c63275b3b3b7323b8759097522e84b267f55a4bd Mon Sep 17 00:00:00 2001 From: Ken Johnson Date: Fri, 31 May 2013 15:54:25 -0400 Subject: [PATCH] dashboard figures actually indicate correct values now --- app/controllers/dashboard_controller.rb | 1 + app/models/paid_time_off.rb | 4 ++++ .../dashboard/_dashboard_stats.html.erb | 18 +++++++++--------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 854e375..4ed95df 100755 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,6 +1,7 @@ class DashboardController < ApplicationController def home + @user = current_user end end diff --git a/app/models/paid_time_off.rb b/app/models/paid_time_off.rb index 0a4abe3..f248361 100644 --- a/app/models/paid_time_off.rb +++ b/app/models/paid_time_off.rb @@ -10,5 +10,9 @@ class PaidTimeOff < ActiveRecord::Base def pto_days_remaining self.pto_earned - self.pto_taken end + + def sick_days_taken_percentage + result = self.sick_days_taken.to_f / self.sick_days_earned.to_f * 100.0 + end end diff --git a/app/views/layouts/dashboard/_dashboard_stats.html.erb b/app/views/layouts/dashboard/_dashboard_stats.html.erb index 238d216..eff889e 100755 --- a/app/views/layouts/dashboard/_dashboard_stats.html.erb +++ b/app/views/layouts/dashboard/_dashboard_stats.html.erb @@ -7,32 +7,32 @@
-
- 10 +
+ <%= @user.paid_time_off.pto_days_remaining %>
Available PTO
-
- 1 +
+ <%= @user.paid_time_off.sick_days_taken %>
Sick Days Taken
-
- $5920 +
+ <%= @user.work_info.income %>
Income
-
- 5.0 +
+ <%= @user.performance.last.score %>
Performance Score @@ -40,7 +40,7 @@
- 71 + <%= @user.retirement.total %>
401k