module Admin::Accounting::Students::BillingScoped
  extend ActiveSupport::Concern

  private
    def student
      @student ||= current_school.students.find_by(id: params[:student_id])
    end

    def bill_plan
      @bill_plan ||= student.billing_plans
        .find_or_initialize_by(school_year: school_year || current_school_year)
    end

    def school_year
      @school_year ||= current_school.school_years.find_by(id: params[:school_year_id])
    end
end
