2015-05-19 10:36:30 +08:00
|
|
|
#学生提交作品表
|
|
|
|
class StudentWork < ActiveRecord::Base
|
2015-06-02 09:33:34 +08:00
|
|
|
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id
|
2015-05-19 10:36:30 +08:00
|
|
|
|
|
|
|
belongs_to :homework_common
|
|
|
|
belongs_to :user
|
2015-05-19 10:56:41 +08:00
|
|
|
has_many :student_works_evaluation_distributions, :dependent => :destroy
|
2015-05-19 11:18:19 +08:00
|
|
|
has_many :student_works_scores, :dependent => :destroy
|
2015-05-21 10:54:02 +08:00
|
|
|
belongs_to :project
|
2015-08-28 12:04:49 +08:00
|
|
|
has_many :student_work_tests, order: 'id desc'
|
2015-05-19 17:12:43 +08:00
|
|
|
|
2015-07-17 14:48:20 +08:00
|
|
|
before_destroy :delete_praise
|
|
|
|
|
2015-05-19 17:12:43 +08:00
|
|
|
acts_as_attachable
|
2015-07-17 14:48:20 +08:00
|
|
|
|
|
|
|
def delete_praise
|
|
|
|
PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all
|
|
|
|
end
|
2015-05-19 10:36:30 +08:00
|
|
|
end
|