管理员界面显示代码测试列表的修改
This commit is contained in:
parent
998106b37b
commit
365540cf1f
|
@ -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 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center; " title='<%=infos.homeworkid%>'>
|
||||
<%=link_to(infos.homeworkid, student_work_index_path(:homework => infos.homeworkid))%>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<% 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 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center; " title='<%=infos.homeworkid%>'>
|
||||
<%=link_to(infos.homeworkid, student_work_index_path(:homework => infos.homeworkid))%>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<% 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 %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=%W(C C++ Python Java).at(infos.language.to_i - 1)%>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=Time.parse(test.created_at.to_s).strftime("%Y-%m-%d %H:%M:%S")%>
|
||||
</td>
|
||||
<td align="center">
|
||||
<% if test.status == 0 %>
|
||||
<%= "答题正确" %>
|
||||
<% elsif test.status == -2 %>
|
||||
<%= "编译错误" %>
|
||||
<% elsif test.status == 2 || test.results.last['status'] == 2 %>
|
||||
<%= "超时" %>
|
||||
<% else %>
|
||||
<%="未记录"%>
|
||||
<%= "答题错误" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=%W(C C++ Python Java).at(infos.language.to_i - 1)%>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=Time.parse(test.created_at.to_s).strftime("%Y-%m-%d %H:%M:%S")%>
|
||||
</td>
|
||||
<td align="center">
|
||||
<% if test.status == 0 %>
|
||||
<%= "答题正确" %>
|
||||
<% elsif test.status == -2 %>
|
||||
<%= "编译错误" %>
|
||||
<% elsif test.status == 2 || test.results.last['status'] == 2 %>
|
||||
<%= "超时" %>
|
||||
<% else %>
|
||||
<%= "答题错误" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% if test.status != -2 %>
|
||||
<%=test.results.count%>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% 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 %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% if test.status != -2 %>
|
||||
<%=test.results.last['time_used'] == 0 ? "1毫秒":test.results.last['time_used'].to_s+"毫秒"%>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% if test.status != -2 %>
|
||||
<%=test.results.count%>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% 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 %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% if test.status != -2 %>
|
||||
<%=test.results.last['time_used'] == 0 ? "1毫秒":test.results.last['time_used'].to_s+"毫秒"%>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue