点赞优化

dev_course
daiao 6 years ago
parent 155e9a0a37
commit 5666a3564e

@ -41,7 +41,7 @@ class GamesController < ApplicationController
# 关卡点赞数, praise_or_tread = 1则表示赞过 # 关卡点赞数, praise_or_tread = 1则表示赞过
praise_count = game_challenge.praises_count praise_count = game_challenge.praises_count
user_praise = game_challenge.praise_tread.exists?(user_id:current_user.id, praise_or_tread: 1) user_praise = game_challenge.praise_treads.exists?(user_id:current_user.id, praise_or_tread: 1)
# 实训的最大评测次数,这个值是为了优化查询,每次只取最新的最新一次评测的结果集 # 实训的最大评测次数,这个值是为了优化查询,每次只取最新的最新一次评测的结果集
max_query_index = @game.query_index.to_i max_query_index = @game.query_index.to_i

Loading…
Cancel
Save