|
|
@ -15,7 +15,7 @@ class HomeworkCommon < ActiveRecord::Base
|
|
|
|
belongs_to :homework_bank
|
|
|
|
belongs_to :homework_bank
|
|
|
|
has_many :homework_group_settings, :dependent => :destroy
|
|
|
|
has_many :homework_group_settings, :dependent => :destroy
|
|
|
|
has_one :homework_detail_manual, :dependent => :destroy
|
|
|
|
has_one :homework_detail_manual, :dependent => :destroy
|
|
|
|
has_one :homework_detail_programing, :dependent => :destroy
|
|
|
|
# has_one :homework_detail_programing, :dependent => :destroy
|
|
|
|
has_one :homework_detail_group, :dependent => :destroy
|
|
|
|
has_one :homework_detail_group, :dependent => :destroy
|
|
|
|
has_one :homework_commons_shixuns, :dependent => :destroy
|
|
|
|
has_one :homework_commons_shixuns, :dependent => :destroy
|
|
|
|
has_many :homework_challenge_settings, :dependent => :destroy
|
|
|
|
has_many :homework_challenge_settings, :dependent => :destroy
|
|
|
@ -24,21 +24,21 @@ class HomeworkCommon < ActiveRecord::Base
|
|
|
|
has_many :homework_review_results, :dependent => :destroy # 学生的查重情况
|
|
|
|
has_many :homework_review_results, :dependent => :destroy # 学生的查重情况
|
|
|
|
|
|
|
|
|
|
|
|
belongs_to :course_homework_category
|
|
|
|
belongs_to :course_homework_category
|
|
|
|
has_many :student_work_projects, :dependent => :destroy
|
|
|
|
has_many :student_work_projects
|
|
|
|
has_many :homework_tests, :dependent => :destroy
|
|
|
|
# has_many :homework_tests, :dependent => :destroy
|
|
|
|
has_many :homework_samples, :dependent => :destroy
|
|
|
|
# has_many :homework_samples, :dependent => :destroy
|
|
|
|
has_many :student_works, :dependent => :destroy, :conditions => "student_works.is_test=0 and student_works.is_delete != 1"
|
|
|
|
has_many :student_works, :conditions => "student_works.is_test=0 and student_works.is_delete != 1"
|
|
|
|
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
|
|
|
|
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
|
|
|
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
|
|
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
|
|
|
has_many :apply_homeworks, :dependent => :destroy
|
|
|
|
has_many :apply_homeworks
|
|
|
|
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
|
|
|
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
|
|
|
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
|
|
|
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
|
|
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
|
|
|
|
# has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
|
|
|
|
has_and_belongs_to_many :shixuns
|
|
|
|
has_and_belongs_to_many :shixuns
|
|
|
|
# 课程动态
|
|
|
|
# 课程动态
|
|
|
|
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
|
|
|
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
|
|
|
# 课程消息
|
|
|
|
# 课程消息
|
|
|
|
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
|
|
|
# has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
|
|
|
has_many :tidings, as: :container, dependent: :destroy
|
|
|
|
has_many :tidings, as: :container, dependent: :destroy
|
|
|
|
acts_as_attachable
|
|
|
|
acts_as_attachable
|
|
|
|
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
|
|
|
|
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
|
|
|
@ -48,7 +48,7 @@ class HomeworkCommon < ActiveRecord::Base
|
|
|
|
# after_create :act_as_activity
|
|
|
|
# after_create :act_as_activity
|
|
|
|
after_update :update_activity
|
|
|
|
after_update :update_activity
|
|
|
|
after_save :act_as_course_activity
|
|
|
|
after_save :act_as_course_activity
|
|
|
|
after_destroy :delete_kindeditor_assets
|
|
|
|
# after_destroy :delete_kindeditor_assets
|
|
|
|
before_destroy :update_homework_bank_quotes
|
|
|
|
before_destroy :update_homework_bank_quotes
|
|
|
|
|
|
|
|
|
|
|
|
#删除时更新题库中的引用数
|
|
|
|
#删除时更新题库中的引用数
|
|
|
|