fix for montlies

This commit is contained in:
Seth Call 2016-09-08 06:06:28 -05:00
parent fd4d21ae78
commit 222b9ea9c6
3 changed files with 7 additions and 3 deletions

View File

@ -769,7 +769,9 @@ module JamRuby
if user
lesson_booking.same_school = !!(lesson_booking.school && user.school && (lesson_booking.school.id == user.school.id))
lesson_booking.same_school_free = lesson_booking.school_on_school_payment?
if lesson_booking.same_school
lesson_booking.same_school_free = !user.school.education # non-education schools (music schools) are 'free' when school-on-school
end
else
lesson_booking.same_school = false
lesson_booking.same_school_free = false

View File

@ -93,7 +93,7 @@ module JamRuby
purchase.price = teacher_dist.amount_in_cents / 100
if lesson_booking.school_on_school_payment?
self.teacher_distributions << TeacherDistribution.create_for_lesson_package_purchase(purchase, true)
purchase.teacher_distributions << TeacherDistribution.create_for_lesson_package_purchase(purchase, true)
end
end
else
@ -164,7 +164,7 @@ module JamRuby
def bill_monthly(force = false)
if school_on_school_payment?
if !payment_if_school_on_school?
puts "SCHOOL ON SCHOOL PAYMENT OH NO"
raise "school-on-school: should not be here"
else

View File

@ -268,6 +268,8 @@ describe "Monthly Recurring Lesson Flow" do
booking.card_presumed_ok.should be_false
booking.user.should eql user
booking.card_presumed_ok.should be_false
booking.same_school.should be_true
booking.same_school_free.should be_false
booking.should eql user.unprocessed_normal_lesson
booking.sent_notices.should be_false
booking.booked_price.should eql 30.00