编译通过但是测试集显示问题

dev_local
huang 6 years ago
parent 69a0a5b72b
commit bea1dd618d

@ -96,7 +96,7 @@ class GamesService
(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
result, test_set_position, g.challenge_id, o.actual_output, o.out_put, o.compile_success
FROM
outputs o left join games g on g.id=o.game_id
WHERE
@ -105,6 +105,7 @@ class GamesService
ON
b.challenge_id = a.challenge_id and b.test_set_position = a.position"
else
# 这个地方如果加字段的话一定注意test_set_static_data方法因为这个地方的字段数在下面有判断
"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"
@ -147,12 +148,13 @@ class GamesService
test_result = []
unless test_sets.blank?
test_sets.each do |test_set|
# 第一次刷新或者没有评测的的时候test_set只需取四个字段所以取了count
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
#actual_output = Base64.encode64(actual_output)
compile_success = (actual_output.blank? || actual_output.downcase.match(/error/).present?) ? 0 : 1
actual_output = (compile_success == 0 ? "编译失败,请在测试结果中查看具体的错误信息" : actual_output)
actual_output = (compile_success.to_s == "0" ? "编译失败,请在测试结果中查看具体的错误信息" : actual_output)
public_result = {:is_public => (test_set.is_public ? 1 : 0), :result => result,
:actual_output => actual_output, :compile_success => compile_success}

Loading…
Cancel
Save