# when a user picks a package, we mark which teachers they actually went with from the package
module JamRuby
  class TestDrivePackageChoice < ActiveRecord::Base

    @@log = Logging.logger[TestDrivePackageChoice]

    belongs_to :test_drive_package, class_name: "JamRuby::TestDrivePackage"
    belongs_to :user, class_name: "JamRuby::User", foreign_key: :user_id, inverse_of: :test_drive_package_choices
    has_many :test_drive_package_choice_teachers, class_name: "JamRuby::TestDrivePackageChoiceTeacher", inverse_of: :test_drive_package_choice
    has_many :lesson_bookings, class_name: "JamRuby::LessonBooking"
  end

  def lesson_package_type
    LessonPackageType.package_for_test_drive_count(test_drive_package_choice_teachers.count)
  end
end

