From 0306071ed083fdc3122d6362bffdaedd03c18363 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 2 Apr 2019 18:40:00 +0800 Subject: [PATCH 1/5] .. --- app/services/games_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/games_service.rb b/app/services/games_service.rb index 6d1f6410..eaf9b51f 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -152,7 +152,7 @@ class GamesService #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 == 0 ? "编译失败,请在测试结果中查看具体的错误信息" : compile_success public_result = {:is_public => (test_set.is_public ? 1 : 0), :result => result, :actual_output => actual_output, :compile_success => compile_success} From 86641c67b1bd6b1122f3c0b7d575fc412b3690ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 2 Apr 2019 19:22:22 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=AD=A6=E6=A0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/_subject_members.html.erb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/subjects/_subject_members.html.erb b/app/views/subjects/_subject_members.html.erb index 45907381..729b8a84 100644 --- a/app/views/subjects/_subject_members.html.erb +++ b/app/views/subjects/_subject_members.html.erb @@ -6,9 +6,12 @@ <%= image_tag(url_to_avatar(member.user), :width =>"80", :height => "80", :class => "radius", :alt=>"头像") %>
-

<%= member.user.try(:show_name) %>

-
-

<%= member.user.school_name %><%= member.user.identity == "学生" ? "" : member.user.identity %>

+

<%= member.user.try(:show_name) %> <%= member.user.identity == "学生" ? "" : member.user.identity %>

+
+

+ + +

From 30f7a4d2bd24c41e07651923d35db2100d6dc273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 2 Apr 2019 19:37:53 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=AD=A6=E6=A0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/_subject_members.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/subjects/_subject_members.html.erb b/app/views/subjects/_subject_members.html.erb index 729b8a84..461a6544 100644 --- a/app/views/subjects/_subject_members.html.erb +++ b/app/views/subjects/_subject_members.html.erb @@ -6,11 +6,11 @@ <%= image_tag(url_to_avatar(member.user), :width =>"80", :height => "80", :class => "radius", :alt=>"头像") %>
-

<%= member.user.try(:show_name) %> <%= member.user.identity == "学生" ? "" : member.user.identity %>

+

<%= member.user.try(:show_name) %>

- + <%= member.user.identity == "学生" ? "" : member.user.identity %>

From 69a0a5b72b8e413c9c2c1c4d3d858a2991a456af Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 3 Apr 2019 09:13:02 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/games_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/games_service.rb b/app/services/games_service.rb index eaf9b51f..e60ec82d 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -152,7 +152,7 @@ class GamesService #actual_output = Base64.encode64(actual_output) compile_success = (actual_output.blank? || actual_output.downcase.match(/error/).present?) ? 0 : 1 - actual_output = compile_success == 0 ? "编译失败,请在测试结果中查看具体的错误信息" : compile_success + actual_output = (compile_success == 0 ? "编译失败,请在测试结果中查看具体的错误信息" : actual_output) public_result = {:is_public => (test_set.is_public ? 1 : 0), :result => result, :actual_output => actual_output, :compile_success => compile_success} From bea1dd618d6d75294137bc66555469b8f2572c70 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 3 Apr 2019 11:04:15 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E4=BD=86=E6=98=AF=E6=B5=8B=E8=AF=95=E9=9B=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/games_service.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/services/games_service.rb b/app/services/games_service.rb index e60ec82d..108cb93e 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -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}