dev_course
daiao 5 years ago
parent f0b6c04e5f
commit 3d7284525f

@ -40,10 +40,8 @@ class GamesController < ApplicationController
next_game = @game.next_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position) next_game = @game.next_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position)
# 关卡点赞数, praise_or_tread = 1则表示赞过 # 关卡点赞数, praise_or_tread = 1则表示赞过
praise_count = PraiseTread.where(praise_tread_object_id: game_challenge.id, praise_tread_object_type: "Challenge", praise_count = game_challenge.praises_count
praise_or_tread: 1).count user_praise = game_challenge.praise_tread.exists?(user_id:current_user.id, praise_or_tread: 1)
user_praise = PraiseTread.where(praise_tread_object_id: game_challenge.id, praise_tread_object_type: "Challenge",
user_id: current_user.id, praise_or_tread: 1).present? ? true : false
# 实训的最大评测次数,这个值是为了优化查询,每次只取最新的最新一次评测的结果集 # 实训的最大评测次数,这个值是为了优化查询,每次只取最新的最新一次评测的结果集
max_query_index = @game.query_index.to_i max_query_index = @game.query_index.to_i

Loading…
Cancel
Save