Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
f1faf010ca
|
@ -95,7 +95,7 @@ class HomeworkCommonController < ApplicationController
|
|||
homework_detail_programing = HomeworkDetailPrograming.new
|
||||
homework_detail_programing.language = "C++"
|
||||
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[:input] = []
|
||||
question[:output] = []
|
||||
|
@ -211,6 +211,7 @@ class HomeworkCommonController < ApplicationController
|
|||
if @homework.homework_type == 2 && @homework_detail_programing #编程作业
|
||||
@homework_detail_programing.language = "C++"
|
||||
@homework_detail_programing.standard_code = params[:standard_code]
|
||||
@homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
|
||||
homework_tests = @homework.homework_tests
|
||||
#需要删除的测试
|
||||
ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# encoding: utf-8
|
||||
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 :student_work
|
||||
|
||||
def status_to_s
|
||||
case self.result
|
||||
case self.result.to_i
|
||||
when -1
|
||||
'编译出错'
|
||||
when -2
|
||||
|
@ -33,7 +33,7 @@ class StudentWorkTest < ActiveRecord::Base
|
|||
end
|
||||
|
||||
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)
|
||||
else
|
||||
0
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
</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>
|
||||
<input type="hidden" value="<%= test.student_work_test.result if test.student_work_test%>">
|
||||
</tr>
|
||||
<% end%>
|
||||
|
||||
|
|
Loading…
Reference in New Issue