aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/holiday.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/holiday.rb')
-rw-r--r--app/models/holiday.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/holiday.rb b/app/models/holiday.rb
index efa516e1c..2a697a7a2 100644
--- a/app/models/holiday.rb
+++ b/app/models/holiday.rb
@@ -32,6 +32,17 @@ class Holiday < ActiveRecord::Base
date.wday == 0 || date.wday == 6 || holidays.include?(date)
end
+ def Holiday.due_date_from(start_date, days, type_of_days)
+ case type_of_days
+ when "working"
+ Holiday.due_date_from_working_days(start_date, days)
+ when "calendar"
+ Holiday.due_date_from_calendar_days(start_date, days)
+ else
+ raise "Unexpected value for type_of_days: #{type_of_days}"
+ end
+ end
+
# Calculate the date on which a request made on a given date falls due when
# days are given in working days
# i.e. it is due by the end of that day.