class Admins::UserSchoolsStatisticsController < Admins::BaseController

  def export
    params[:per_page] = 500
    _count, @schools = Admins::UserSchoolsStatisticQuery.call(params)

    filename = ['用户运营统计', Time.zone.now.strftime('%Y%m%d%H%M%S')].join('-') << '.xlsx'
    render xlsx: 'export', filename: filename
  end

  def index
    default_sort('cnt', 'desc')
    total_count, schools = Admins::UserSchoolsStatisticQuery.call(params)

    @schools = paginate schools, total_count: total_count

  end
end