编程作业结果显示问题
This commit is contained in:
parent
b2f8494342
commit
9f72b25360
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue