diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2012-09-24 13:43:40 +1000 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2012-09-24 13:43:40 +1000 |
commit | 42998406cd909332382d80af3c7c4a9d58ffbe23 (patch) | |
tree | 1be581ffb49125b2272b921462f3f22e4871d079 /app/models | |
parent | 7df2900a1beae8ab73aae47f5956064b2dbd0e00 (diff) |
Add due date calculation based on calendar days rather than working days
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/holiday.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/holiday.rb b/app/models/holiday.rb index 237fe5757..f07e3b05e 100644 --- a/app/models/holiday.rb +++ b/app/models/holiday.rb @@ -59,4 +59,13 @@ class Holiday < ActiveRecord::Base response_required_by end + # Calculate the date on which a request made on a given date falls due when + # the days are given in calendar days (rather than working days) + def Holiday.due_date_from_calendar_days(start_date, days) + response_required_by = start_date + days + while weekend_or_holiday?(response_required_by) + response_required_by += 1 + end + response_required_by + end end |