解锁测试集

dev_forum
daiao 6 years ago
parent 7c1635f157
commit 1f224b6812

@ -344,11 +344,20 @@ class GamesController < ApplicationController
@game.update_attribute(:test_sets_view, true) @game.update_attribute(:test_sets_view, true)
# 扣分记录 # 扣分记录
Grade.create(:user_id => current_user.id, :container_id => @game.id, :score => -@minus_grade, :container_type => "testSet") Grade.create(:user_id => current_user.id, :container_id => @game.id, :score => -@minus_grade, :container_type => "testSet")
@status = 0 max_query_index = game.query_index.to_i
@message = "解锁成功!" # 区分评测过未评测过,未评测过按需求取数据
if max_query_index > 0
qurey_test_sets = TestSet.find_by_sql("SELECT o.code, o.actual_output, o.out_put, o.result, o.compile_success, o.test_set_position, o.query_index,t.is_public,t.input, t.output, g.id as game_id, c.id as challenge_id FROM outputs o,games g ,challenges c,test_sets t where
g.id=#{game.id} and o.query_index=#{max_query_index} and g.id = o.game_id and c.id= g.challenge_id and t.challenge_id = c.id and t.position =o.test_set_position order by o.query_index
")
else
qurey_test_sets = TestSet.find_by_sql("SELECT t.is_public,t.input, t.output,t.position FROM games g ,challenges c,test_sets t where
g.id=#{game.id} and c.id= g.challenge_id and t.challenge_id = c.id
")
end
testset_detail max_query_index, challenge
else else
@status = -1 tip_exception(-1, "本操作需要扣除#{ @minus_grade }金币,您的金币不够了")
@message = "本操作需要扣除#{ @minus_grade }金币,您的金币不够了"
end end
end end
@ -813,7 +822,7 @@ class GamesController < ApplicationController
# 评测测试机封装 # 评测测试机封装
def testset_detail max_query_index, challenge def testset_detail max_query_index, challenge
# 是否允许查看隐藏的测试集以前的power # 是否允许查看隐藏的测试集以前的power
@allowed_hidden_testset = @identity < User::EDU_GAME_MANAGER @allowed_hidden_testset = @identity < User::EDU_GAME_MANAGER || @game.test_sets_view #解锁的用户
if max_query_index > 0 if max_query_index > 0
uid_logger("max_query_index is #{max_query_index} game id is #{@game.id}, challenge_id is #{challenge.id}") uid_logger("max_query_index is #{max_query_index} game id is #{@game.id}, challenge_id is #{challenge.id}")

@ -1233,7 +1233,7 @@ class HomeworkCommonsController < ApplicationController
# 代码查重届结果 # 代码查重届结果
def code_review_results def code_review_results
# 如果有未获取结果的查重操作 则先读取结果 # 如果有未获取结果的查重操作 则先读取结果
#get_new_code_reviews_result @homework get_new_code_reviews_result @homework
@current_user = current_user @current_user = current_user
# 列表数据 # 列表数据

@ -1,2 +1 @@
json.status @status json.partial! 'games/testset_list'
json.message @message
Loading…
Cancel
Save