From daddb138a5080be5e41ef2156f9d0faa3a564973 Mon Sep 17 00:00:00 2001 From: Ken Johnson Date: Sat, 25 May 2013 03:01:53 -0400 Subject: [PATCH] okay, I am tired, I am just gonna continue this effort sat night or sun. Anyways, some of the main things this app should do are running so not a bad day. I would say we are only a couple days from beta release. --- app/controllers/paid_time_off_controller.rb | 1 + app/models/paid_time_off.rb | 14 ++++++++++++++ app/views/paid_time_off/index.html.erb | 14 +++++++------- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/app/controllers/paid_time_off_controller.rb b/app/controllers/paid_time_off_controller.rb index 84c0d84..07f571b 100644 --- a/app/controllers/paid_time_off_controller.rb +++ b/app/controllers/paid_time_off_controller.rb @@ -1,5 +1,6 @@ class PaidTimeOffController < ApplicationController def index + @pto = current_user.paid_time_off end end diff --git a/app/models/paid_time_off.rb b/app/models/paid_time_off.rb index 28497b1..a4dadd0 100644 --- a/app/models/paid_time_off.rb +++ b/app/models/paid_time_off.rb @@ -1,5 +1,19 @@ class PaidTimeOff < ActiveRecord::Base attr_accessible :pto_earned, :pto_taken, :sick_days_earned, :sick_days_taken, :user_id belongs_to :user + + # Refactor this duplication when it's not 3am + def sick_days_remaining(val="") + self.sick_days_earned - self.sick_days_taken + end + + + def pto_days_remaining(val="") + self.pto_earned - self.pto_taken + end + + def pto_percentages + end + end diff --git a/app/views/paid_time_off/index.html.erb b/app/views/paid_time_off/index.html.erb index 97d86d2..a91dd0f 100644 --- a/app/views/paid_time_off/index.html.erb +++ b/app/views/paid_time_off/index.html.erb @@ -16,8 +16,8 @@ Sick Days Taken - - 32% + + <%= @pto.sick_days_taken %>
@@ -31,7 +31,7 @@ Sick Days Earned - 32% + <%= @pto.sick_days_earned %>
@@ -45,7 +45,7 @@ Sick Days Remaining - 84% + <%= @pto.sick_days_remaining %>
@@ -76,7 +76,7 @@ PTO Days Taken - 32% + <%= @pto.pto_taken %>
@@ -90,7 +90,7 @@ PTO Days Earned - 32% + <%= @pto.pto_earned %>
@@ -104,7 +104,7 @@ PTO Days Remaining - 84% + <%= @pto.pto_days_remaining %>