已发布的实训.增加测试集,已完成关卡的用户无法更新测试集内容

dev_shixuns
daiao 6 years ago
parent 2fdf5353c4
commit 2a68ed0cb0

@ -90,14 +90,22 @@ class GamesService
# 区分评测过未评测过,未评测过按需求取数据
sql =
if max_query_index > 0
"SELECT o.actual_output, o.out_put, o.result, 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 test_sets t, outputs o,games g ,challenges c
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"
"SELECT
b.actual_output, b.out_put, b.result, a.is_public, a.input
FROM
(SELECT position, input, challenge_id, is_public FROM test_sets where challenge_id=6000) a
LEFT JOIN
(SELECT
result, test_set_position, g.challenge_id, o.actual_output, o.out_put
FROM
outputs o left join games g on g.id=o.game_id
WHERE
game_id=#{game.id} and query_index = #{max_query_index}
) b
ON
b.challenge_id = a.challenge_id and b.test_set_position = a.position"
else
"SELECT t.is_public,t.input, t.output, t.position
"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

Loading…
Cancel
Save