class School::Legacy::QuartersController < ApplicationController
  def index
    render_success :ok, json: quarters.map { |q| quarter_props(q) }
  end

  private
    def quarters
      current_school.school_config.quarters
    end

    def current_quarter
      @current_quarter ||= current_school_year.closest_quarter
    end

    def quarter_props(quarter)
      {
        id: quarter.first,
        name: quarter.last,
        current: current_quarter == quarter.first
      }
    end
end
