diff --git a/ruby/lib/jam_ruby/models/lesson_booking.rb b/ruby/lib/jam_ruby/models/lesson_booking.rb index a4f1efb8d..4ab4c9406 100644 --- a/ruby/lib/jam_ruby/models/lesson_booking.rb +++ b/ruby/lib/jam_ruby/models/lesson_booking.rb @@ -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 diff --git a/ruby/lib/jam_ruby/models/lesson_package_purchase.rb b/ruby/lib/jam_ruby/models/lesson_package_purchase.rb index 076d14338..0f99ebe1e 100644 --- a/ruby/lib/jam_ruby/models/lesson_package_purchase.rb +++ b/ruby/lib/jam_ruby/models/lesson_package_purchase.rb @@ -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 diff --git a/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb b/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb index fee6bf527..abcf90101 100644 --- a/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb +++ b/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb @@ -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