This commit is contained in:
huang 2015-07-20 17:44:27 +08:00
commit f1faf010ca
3 changed files with 6 additions and 4 deletions

View File

@ -95,7 +95,7 @@ class HomeworkCommonController < ApplicationController
homework_detail_programing = HomeworkDetailPrograming.new homework_detail_programing = HomeworkDetailPrograming.new
homework_detail_programing.language = "C++" homework_detail_programing.language = "C++"
homework_detail_programing.standard_code = params[:standard_code] homework_detail_programing.standard_code = params[:standard_code]
homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
question = {title:homework.name,content:homework.description} question = {title:homework.name,content:homework.description}
question[:input] = [] question[:input] = []
question[:output] = [] question[:output] = []
@ -211,6 +211,7 @@ class HomeworkCommonController < ApplicationController
if @homework.homework_type == 2 && @homework_detail_programing #编程作业 if @homework.homework_type == 2 && @homework_detail_programing #编程作业
@homework_detail_programing.language = "C++" @homework_detail_programing.language = "C++"
@homework_detail_programing.standard_code = params[:standard_code] @homework_detail_programing.standard_code = params[:standard_code]
@homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
homework_tests = @homework.homework_tests homework_tests = @homework.homework_tests
#需要删除的测试 #需要删除的测试
ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i) ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i)

View File

@ -1,12 +1,12 @@
# encoding: utf-8 # encoding: utf-8
class StudentWorkTest < ActiveRecord::Base class StudentWorkTest < ActiveRecord::Base
attr_accessible :student_work_id, :homework_test_id attr_accessible :student_work_id, :homework_test_id, :result
belongs_to :homework_test belongs_to :homework_test
belongs_to :student_work belongs_to :student_work
def status_to_s def status_to_s
case self.result case self.result.to_i
when -1 when -1
'编译出错' '编译出错'
when -2 when -2
@ -33,7 +33,7 @@ class StudentWorkTest < ActiveRecord::Base
end end
def test_score def test_score
if self.result == 0 if self.result.to_i == 0
format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count) format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count)
else else
0 0

View File

@ -49,6 +49,7 @@
</td> </td>
<td class="td_50 c_red"><%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%></td> <td class="td_50 c_red"><%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%></td>
<td class="td_50 "><%= test.student_work_test.nil? ? "0" : test.student_work_test.test_score%></td> <td class="td_50 "><%= test.student_work_test.nil? ? "0" : test.student_work_test.test_score%></td>
<input type="hidden" value="<%= test.student_work_test.result if test.student_work_test%>">
</tr> </tr>
<% end%> <% end%>