From 365540cf1f09819c5e85dd699932ee87c58f7289 Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 15 Apr 2016 12:39:22 +0800
Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C=E9=9D=A2?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BB=A3=E7=A0=81=E6=B5=8B=E8=AF=95=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E7=9A=84=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/admin/code_work_tests.html.erb | 92 ++++++++++++------------
1 file changed, 47 insertions(+), 45 deletions(-)
diff --git a/app/views/admin/code_work_tests.html.erb b/app/views/admin/code_work_tests.html.erb
index 9fbd2fa46..29fb588c2 100644
--- a/app/views/admin/code_work_tests.html.erb
+++ b/app/views/admin/code_work_tests.html.erb
@@ -39,53 +39,55 @@
<% @code_work_tests.each do |test| %>
<% infos = StudentWorkTest.find_by_sql("select a.homework_common_id as homeworkid,b.language from student_works as a, homework_detail_programings as b where a.id = #{test.student_work_id} and a.homework_common_id = b.homework_common_id
").first %>
-
">
-
- <%=link_to(infos.homeworkid, student_work_index_path(:homework => infos.homeworkid))%>
- |
-
- <% if test.status != -2 && test.results.first['user_wait'] %>
- <% wait_time = 0 %>
- <% test.results.each do |result| wait_time = wait_time + result['user_wait'] end %>
- <%=(wait_time/test.results.count).to_s+"毫秒" %>
+ <% if infos != nil %>
+ |
">
+
+ <%=link_to(infos.homeworkid, student_work_index_path(:homework => infos.homeworkid))%>
+ |
+
+ <% if test.status != -2 && test.results.first['user_wait'] %>
+ <% wait_time = 0 %>
+ <% test.results.each do |result| wait_time = wait_time + result['user_wait'] end %>
+ <%=(wait_time/test.results.count).to_s+"毫秒" %>
+ <% else %>
+ <%="未记录"%>
+ <% end %>
+ |
+
+ <%=%W(C C++ Python Java).at(infos.language.to_i - 1)%>
+ |
+
+ <%=Time.parse(test.created_at.to_s).strftime("%Y-%m-%d %H:%M:%S")%>
+ |
+
+ <% if test.status == 0 %>
+ <%= "答题正确" %>
+ <% elsif test.status == -2 %>
+ <%= "编译错误" %>
+ <% elsif test.status == 2 || test.results.last['status'] == 2 %>
+ <%= "超时" %>
<% else %>
- <%="未记录"%>
+ <%= "答题错误" %>
<% end %>
- |
-
- <%=%W(C C++ Python Java).at(infos.language.to_i - 1)%>
- |
-
- <%=Time.parse(test.created_at.to_s).strftime("%Y-%m-%d %H:%M:%S")%>
- |
-
- <% if test.status == 0 %>
- <%= "答题正确" %>
- <% elsif test.status == -2 %>
- <%= "编译错误" %>
- <% elsif test.status == 2 || test.results.last['status'] == 2 %>
- <%= "超时" %>
- <% else %>
- <%= "答题错误" %>
- <% end %>
- |
-
- <% if test.status != -2 %>
- <%=test.results.count%>
- <% end %>
- |
-
- <% if test.status != -2 %>
- <%test.results = test.results.sort_by {|result| result['time_used'] }%>
- <%=test.results.first['time_used'] == 0 ? "1毫秒":test.results.first['time_used'].to_s+"毫秒"%>
- <% end %>
- |
-
- <% if test.status != -2 %>
- <%=test.results.last['time_used'] == 0 ? "1毫秒":test.results.last['time_used'].to_s+"毫秒"%>
- <% end %>
- |
-
+
+
+ <% if test.status != -2 %>
+ <%=test.results.count%>
+ <% end %>
+ |
+
+ <% if test.status != -2 %>
+ <%test.results = test.results.sort_by {|result| result['time_used'] }%>
+ <%=test.results.first['time_used'] == 0 ? "1毫秒":test.results.first['time_used'].to_s+"毫秒"%>
+ <% end %>
+ |
+
+ <% if test.status != -2 %>
+ <%=test.results.last['time_used'] == 0 ? "1毫秒":test.results.last['time_used'].to_s+"毫秒"%>
+ <% end %>
+ |
+
+ <% end %>
<% end %>