dev_local
SylorHuang 6 years ago
parent 828ac000e0
commit 7af1176280

@ -1175,24 +1175,28 @@ end
@menu_type = 6
@sub_type = 3
@partners = Partner.includes(:school)
@schools = School.where("partner_id IS NULL").all
@page = (params['page'] || 1).to_i
@schools_count = @schools.count
@limit = 10
@is_remote = true
@schools_pages = Paginator.new @schools_count, @limit, @page
@offset ||=@schools_pages.offset
@schools = paginateHelper @schools, @limit
end
def all_partners
@search = params[:search]
@province = params[:province]
@schools = School.where("partner_id IS NULL").all
if params[:search]
@schools = @schools.where("name like ?", "%#{@search}%")
end
if params[:province]
@schools = @schools.where("province like ?", "%#{@province}%")
end
@page = (params['page'] || 1).to_i
@schools_count = @schools.count
@total_pages = (@schools_count / 10.0).ceil
@limit = 10
@is_remote = true
@schools_pages = Paginator.new @schools_count, @limit, @page
@offset ||=@schools_pages.offset
@schools = paginateHelper @schools, @limit
render :json => @schools
end

Loading…
Cancel
Save