pre_develop
daiao 6 years ago
parent 40a1e1d034
commit f17754c148

@ -7,7 +7,7 @@ class CnmoocsService
limit = params[:pageSize] || 16 limit = params[:pageSize] || 16
offset = page * limit.to_i offset = page * limit.to_i
shixuns = Shixun.select([:id, :identifier, :name, :myshixuns_count, :averge_star, :challenges_count, :trainee]). shixuns = Shixun.select([:id, :identifier, :name, :myshixuns_count, :averge_star, :challenges_count, :trainee]).
where(status: 0, hidden: 0) where(status: 2, hidden: 0)
shixun_count = shixuns.count shixun_count = shixuns.count
pageCount = ((shixun_count / limit.to_f) == (shixun_count / limit)) ? (shixun_count / limit) : ((shixun_count / limit) + 1) pageCount = ((shixun_count / limit.to_f) == (shixun_count / limit)) ? (shixun_count / limit) : ((shixun_count / limit) + 1)
Rails.logger.info("#####{pageCount}") Rails.logger.info("#####{pageCount}")

Loading…
Cancel
Save