| Class | Room |
| In: |
app/models/room.rb
|
| Parent: | ActiveRecord::Base |
************************************************************************/
************************************************************************/
Returns an array of minimum stay Array [month][day_of_month] = default
# File app/models/room.rb, line 23
23: def self.get_default_minimum_stay(default)
24:
25: months = Hash.new
26: month_data = Hash.new
27:
28: (1 .. 12).each do |month|
29:
30: days = Hash.new
31: (1 .. 31).each do |day|
32:
33: days["#{day}"] = default
34:
35: end
36: months["#{month}"] = days
37: end
38: return months
39: end
Set the minimum stay for a period of the year
# File app/models/room.rb, line 42
42: def self.new_minimum_stay(room, start_day, start_month, stop_day, stop_month, new_minimum_stay)
43: prl = room.minimum_stay
44: convert_start = ::Time.local(*ParseDate.parsedate("2000-" + start_month + "-" + start_day))
45: convert_stop = ::Time.local(*ParseDate.parsedate("2000-" + stop_month + "-" + stop_day))
46: counter = convert_start
47:
48: while counter <= convert_stop do
49: prl["#{counter.month}"]["#{counter.mday}"] = new_minimum_stay
50: counter = counter + 1.day
51: end
52: return prl
53: end