增加匿评分配作业表,以及和作业、作品、用户表关系键确认
This commit is contained in:
parent
52dabc6b98
commit
c045b4682a
|
@ -28,6 +28,7 @@ class Bid < ActiveRecord::Base
|
||||||
has_many :homework_for_courses, :dependent => :destroy
|
has_many :homework_for_courses, :dependent => :destroy
|
||||||
has_many :courses, :through => :homework_for_courses, :source => :course
|
has_many :courses, :through => :homework_for_courses, :source => :course
|
||||||
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
|
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
|
||||||
|
has_many :homework_evaluations, :through => :homeworks
|
||||||
has_many :join_in_contests, :dependent => :destroy
|
has_many :join_in_contests, :dependent => :destroy
|
||||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||||
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
|
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
|
||||||
|
|
|
@ -10,6 +10,7 @@ class HomeworkAttach < ActiveRecord::Base
|
||||||
has_many :users, :through => :homework_users
|
has_many :users, :through => :homework_users
|
||||||
seems_rateable :allow_update => true, :dimensions => :quality
|
seems_rateable :allow_update => true, :dimensions => :quality
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
has_many :homework_evaluations, :dependent => :destroy
|
||||||
|
|
||||||
safe_attributes "bid_id",
|
safe_attributes "bid_id",
|
||||||
"user_id"
|
"user_id"
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
class HomeworkEvaluation < ActiveRecord::Base
|
||||||
|
attr_accessible :homework_attach_id, :user_id
|
||||||
|
|
||||||
|
belongs_to :homework_attach
|
||||||
|
belongs_to :user
|
||||||
|
end
|
|
@ -75,6 +75,7 @@ class User < Principal
|
||||||
|
|
||||||
has_many :homework_users
|
has_many :homework_users
|
||||||
has_many :homework_attaches, :through => :homework_users
|
has_many :homework_attaches, :through => :homework_users
|
||||||
|
has_many :homework_evaluations
|
||||||
|
|
||||||
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
|
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
|
||||||
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateHomeworkEvaluations < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :homework_evaluations do |t|
|
||||||
|
t.string :user_id
|
||||||
|
t.string :homework_attach_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20141029065917) do
|
ActiveRecord::Schema.define(:version => 20141031111632) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -478,6 +478,13 @@ ActiveRecord::Schema.define(:version => 20141029065917) do
|
||||||
t.integer "project_id", :default => 0
|
t.integer "project_id", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "homework_evaluations", :force => true do |t|
|
||||||
|
t.string "user_id"
|
||||||
|
t.string "homework_attach_id"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "homework_for_courses", :force => true do |t|
|
create_table "homework_for_courses", :force => true do |t|
|
||||||
t.integer "course_id"
|
t.integer "course_id"
|
||||||
t.integer "bid_id"
|
t.integer "bid_id"
|
||||||
|
|
Loading…
Reference in New Issue