输入输出结果集只要老师才可以看到

This commit is contained in:
sw 2015-07-27 10:43:39 +08:00
parent 9a9658baf3
commit b94f5a54cc
2 changed files with 35 additions and 36 deletions

View File

@ -48,7 +48,7 @@
</div>
<div class="cl"></div>
<% if homework.homework_type == 2 && homework.homework_detail_programing%>
<% if homework.homework_type == 2 && homework.homework_detail_programing && @is_teacher%>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class="<%= cycle("", "b_grey") %>">

View File

@ -24,42 +24,41 @@
<div class="cl"></div>
</li>
<li ><span class="tit_fb ">测试结果:</span>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class=" b_lblue fb c_w">
<td class="td_tit ">输入</td>
<td class="td_tit border_l ">输出</td>
<td class="td_50 border_l ">测试结果</td>
</tr>
<%@homework.homework_tests.each do |test|%>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit hidden">
<%= test.input%>
</td>
<td class="td_tit border_l hidden">
<%= test.output%>
</td>
<% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%>
<td class="td_50 c_red border_l"><%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%></td>
<input type="hidden" value="<%= student_work_test.result if student_work_test%>">
</tr>
<% end%>
<% student_work_test = @work.student_work_test.first%>
<% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%>
<tr class="border_t" >
<td colspan="3" class="td_end" >
<%= student_work_test.error_msg%>
</td>
</tr>
<% end%>
</tbody>
</table>
<div class="cl"></div>
</li>
<% if @is_teacher%>
<li ><span class="tit_fb ">测试结果:</span>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class=" b_lblue fb c_w">
<td class="td_tit ">输入</td>
<td class="td_tit border_l ">输出</td>
<td class="td_50 border_l ">测试结果</td>
</tr>
<%@homework.homework_tests.each do |test|%>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit hidden">
<%= test.input%>
</td>
<td class="td_tit border_l hidden">
<%= test.output%>
</td>
<% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%>
<td class="td_50 c_red border_l"><%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%></td>
<input type="hidden" value="<%= student_work_test.result if student_work_test%>">
</tr>
<% end%>
<% student_work_test = @work.student_work_test.first%>
<% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%>
<tr class="border_t" >
<td colspan="3" class="td_end" >
<%= student_work_test.error_msg%>
</td>
</tr>
<% end%>
</tbody>
</table>
<div class="cl"></div>
</li>
<!-- 编程作业老师才可以评分 -->
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>