Displaying 2 results from an estimated 2 matches for "duration_in_week".
Did you mean:
duration_in_weeks
2008 Aug 25
2
maths not working (can't get this)
...t and display two prices, one discounted / one
full). Be grateful for answers...
The total price and discounted price are not calculated correctly and
the duration is not coming through to the output page.
---------------
class Course < ActiveRecord::Base
has_one :enquiry
attr_accessor :duration_in_weeks
def self.all_courses
find(:all)
end
def self.active_courses
# find(:all)
# find(:all, :conditions => ["active = ?", true], :order =>
''created_at DESC'', :limit => 5)
find(:all, :conditions => {:archive => false}, :order =>
'&...
2008 Aug 31
6
why's my course_duration being reset
...fee = accomodation.booking_fee
end
def calculate_fees
# DO STUFF !
# self.blah_fee = blah_duration * whatever
self.course_fee = course.price_per_week * course_duration.to_i
self.accommodation_fee = accomodation.price_per_week *
accomodation_duration.to_i
@factor = case @duration_in_weeks
when 1..4
1.0
when 5..12
0.9
when 13..24
0.8
when 25..47
0.7
else # from 48 and up
0.5
end
self.course_fee = (self.course_fee * @factor)
self.total_fee = course_booking_fee + accommodation_booking_fee +
course_f...