Merge branch 'educoder' into develop

dev_haigong
huang 6 years ago
commit a199ffa2cf

@ -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
compile_success == 0 ? "编译失败,请在测试结果中查看具体的错误信息" : compile_success
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}

@ -7,8 +7,11 @@
</a>
<div class="fl ml15 flex1">
<p class="mb10 mt5"><%= member.user.try(:show_name) %></p>
<div class="clearfix">
<p class="color-grey-9 font-12 fl"><span class="mr10"><%= member.user.school_name %></span><span><%= member.user.identity == "学生" ? "" : member.user.identity %></span></p>
<div class="clearfix ml3">
<p class="color-grey-9 font-12 fl">
<!-- <span class="mr10"><%#= member.user.school_name %></span>-->
<span><%= member.user.identity == "学生" ? "" : member.user.identity %></span>
</p>
<!--<a href="JavaScript:void(0)" class="edu-default-btn edu-focus-btn fr color-grey-6">关注</a>-->
</div>
</div>

Loading…
Cancel
Save