lib/sum/model/user.rb in sum-0.1.1 vs lib/sum/model/user.rb in sum-0.1.2

- old
+ new

@@ -116,11 +116,11 @@ self.reset_at - 1.month end # Days in this fiscal month def days_in_month - self.reset_at.to_date - self.beginning_of_month.to_date + (self.reset_at.to_date - self.beginning_of_month.to_date).to_i end # Days left in this fiscal month def days_left to_local(self.reset_at).to_date - to_local(Time.now).to_date - 1 @@ -136,11 +136,11 @@ to_local(Time.now).to_date - to_local(self.beginning_of_month).to_date end # Days passed in this fiscal month, including today def days_passed_including_today - self.days_passed + 1 + (self.days_passed + 1).to_i end # Reset spent_today def reset_spent_today! self.update_attribute :spent_today, 0 @@ -197,10 +197,10 @@ (self.savings_goal + self.surplus(:exclude_today)) / self.days_left_including_today end # How much the user is spending per day (ideally) def spending_per_day - self.spending_goal / self.days_in_month + self.spending_goal / self.days_in_month.to_f end # How much the user has spent this month def spent_this_month(option=nil) case option