lib/frequency_calculation.rb
# Returns an array of unique due dates.
Returns an array of unique due dates.
Returns an array of unique due dates .
def calculate(frequency, frequency_integer, start_date, end_date)
    first_due_date = @calendar.roll_forward(start_date)
    base_dates = [first_due_date]
    return [base_dates, base_dates] if frequency == 'Once'
    frequency_symbol = get_frequency_symbol(frequency)
    grace_dates = [first_due_date.advance(frequency_symbol => frequency_integer)]
    base_date = start_date
    end_date = calculate_end_date(start_date, end_date)
    while base_date < end_date
      grace_date = base_date.advance(frequency_symbol => frequency_integer*2)
      base_date = base_date.advance(frequency_symbol => frequency_integer)
      base_dates << @calendar.roll_forward(base_date)
      grace_dates << @calendar.roll_forward(grace_date)
    end
    [base_dates, grace_dates]
  end
def calculate ( frequency , frequency_integer , start_date , end_date ) first_due_date = @calendar . roll_forward ( start_date ) base_dates = [ first_due_date ] return [ base_dates , base_dates ] if frequency == 'Once' frequency_symbol = get_frequency_symbol ( frequency ) grace_dates = [ first_due_date . advance ( frequency_symbol => frequency_integer ) ] base_date = start_date end_date = calculate_end_date ( start_date , end_date ) while base_date < end_date grace_date = base_date . advance ( frequency_symbol => frequency_integer * 2 ) base_date = base_date . advance ( frequency_symbol => frequency_integer ) base_dates << @calendar . roll_forward ( base_date ) grace_dates << @calendar . roll_forward ( grace_date ) end [ base_dates , grace_dates ] end
Returns an array of unique due dates.
Returns an array of unique due dates .
frequency
<not_specific>
frequency_integer
<not_specific>
start_date
<not_specific>
end_date
<not_specific>