编程作业结果显示问题

This commit is contained in:
sw 2015-07-20 16:22:18 +08:00
parent b2f8494342
commit 9f72b25360
1 changed files with 3 additions and 3 deletions

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