<% content_for :header_tags do %> <%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %> <%= javascript_include_tag 'homework','baiduTemplate' %> <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> <% end %>
<%= @is_test ? '模拟答题' : '提交作品' %>
<%= @homework.name %>
截止时间:<%= @homework.end_time %>
<%= @homework.user.show_name %>

<%= @homework.description.html_safe %>

<%= form_for(@student_work, :html => { :multipart => true }, :url => {:controller => 'users', :action => 'user_commit_homework', :student_work_id => @student_work.id, :homework => @homework.id }, :method => :post) do |f|%>
请使用 <%= @homework.language_name %> 语言编写 <% if @homework.language.to_i == 1 %> 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) <% elsif @homework.language.to_i == 2 %> 编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC) <% elsif @homework.language.to_i == 3 %> 编译器信息:Python version "2.6.6" <% elsif @homework.language.to_i == 4 %> 编译器信息:java version "1.7.0_85" OpenJDK Runtime Environment <% end %> style="display-hidden" id="data-language">
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能", value:"#{@homework.name}的作品提交" %>
<%= f.text_area :description, id: 'program-src', class:"InputBox W700 H150", placeholder:"请贴入你的代码", rows: 10 %>
测试代码 <% if @is_test %> <%=link_to '返 回',homework_common_index_path(:course => @course.id),:class=>'fr mt6',:style =>'line-height:30px;' %> <% else @is_test %> 提交代码 <% end %>
<% end %>
<% @student_work.student_work_tests.each_with_index do |test, index| %>

第<%= @student_work.student_work_tests.count - index%>次测试

<%= format_time(test.created_at).to_s%>
<% if test.status.to_i == -2 %>
<%= test.results.first %>
<% else %>
    <% test.results.reverse.each_with_index do |x, i| %> <% unless x.nil? %>
  • 测试<%=test.results.size-i%> <% if x["status"].to_i != 0 %> <% if x["status"].to_i == 2 %> 超时! <% else %> 测试错误! <% end %> 您的输出:
    <%=x["result"].force_encoding("UTF-8")%> 
    正确输出:
    <%= x["output"].force_encoding("UTF-8") %>
     耗时:
    <%=x["time_used"]==0?1:x["time_used"]%>毫秒
  • <% else %> 测试正确!    耗时:
    <%=x["time_used"]==0?1:x["time_used"]%>毫秒
    <% end %> <% end %> <% end %>
<% end %> <% end %>