|
|
|
@ -92,12 +92,12 @@ class GamesService
|
|
|
|
|
sql =
|
|
|
|
|
if max_query_index > 0
|
|
|
|
|
"SELECT
|
|
|
|
|
b.actual_output, b.out_put, b.result, b.compile_success, a.is_public, a.input, a.output
|
|
|
|
|
b.code, b.actual_output, b.out_put, b.result, b.compile_success, a.is_public, a.input, a.output
|
|
|
|
|
FROM
|
|
|
|
|
(SELECT position, input, output, challenge_id, is_public FROM test_sets where challenge_id=#{game_challenge.id}) a
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
(SELECT
|
|
|
|
|
result, test_set_position, g.challenge_id, o.actual_output, o.out_put, o.compile_success
|
|
|
|
|
result, test_set_position, g.challenge_id, o.actual_output, o.out_put, o.compile_success, o.code
|
|
|
|
|
FROM
|
|
|
|
|
outputs o left join games g on g.id=o.game_id
|
|
|
|
|
WHERE
|
|
|
|
@ -153,9 +153,10 @@ class GamesService
|
|
|
|
|
actual_output = test_set.attributes.count > 4 ? test_set.try(:actual_output) : nil
|
|
|
|
|
result = test_set.attributes.count > 4 ? test_set.try(:result) : nil
|
|
|
|
|
compile_success = test_set.attributes.count > 4 ? test_set.try(:compile_success) : nil
|
|
|
|
|
status = test_set.attributes.count > 4 ? test_set.try(:code) : nil
|
|
|
|
|
#actual_output = Base64.encode64(actual_output)
|
|
|
|
|
|
|
|
|
|
actual_output = (compile_success.to_s == "0" ? "编译失败,请在测试结果中查看具体的错误信息" : actual_output)
|
|
|
|
|
actual_output = (compile_success.to_s == "0" && status.to_s == "-1" ? "编译失败,请在测试结果中查看具体的错误信息" : actual_output)
|
|
|
|
|
|
|
|
|
|
public_result = {:is_public => (test_set.is_public ? 1 : 0), :result => result,
|
|
|
|
|
:actual_output => actual_output, :compile_success => compile_success}
|
|
|
|
|