编程作业结果增加错误信息的存储

This commit is contained in:
sw 2015-07-22 10:06:55 +08:00
parent d9f312bbe3
commit 5bd1cdc4eb
3 changed files with 11 additions and 1 deletions

View File

@ -396,6 +396,7 @@ class StudentWorkController < ApplicationController
if student_work_test.result == 0 if student_work_test.result == 0
student_score_count += 1 student_score_count += 1
end end
student_work_test.error_msg = params[:compile_error_msg]
student_work_test.save! student_work_test.save!
end end
end end

View File

@ -1,6 +1,6 @@
# encoding: utf-8 # encoding: utf-8
class StudentWorkTest < ActiveRecord::Base class StudentWorkTest < ActiveRecord::Base
attr_accessible :student_work_id, :homework_test_id, :result attr_accessible :student_work_id, :homework_test_id, :result, :error_msg
belongs_to :homework_test belongs_to :homework_test
belongs_to :student_work belongs_to :student_work

View File

@ -0,0 +1,9 @@
class AddErrormsgToStudenWorkTest < ActiveRecord::Migration
def up
add_column :student_work_tests,:error_msg,:text
end
def down
remove_column :student_work_tests,:error_msg,
end
end