aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2012-09-24 13:43:40 +1000
committerMatthew Landauer <matthew@openaustralia.org>2012-09-24 13:43:40 +1000
commit42998406cd909332382d80af3c7c4a9d58ffbe23 (patch)
tree1be581ffb49125b2272b921462f3f22e4871d079 /app/models
parent7df2900a1beae8ab73aae47f5956064b2dbd0e00 (diff)
Add due date calculation based on calendar days rather than working days
Diffstat (limited to 'app/models')
-rw-r--r--app/models/holiday.rb9
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