讨论区动态重复出现
This commit is contained in:
parent
7d6b9005a4
commit
585818fe7a
|
@ -14,13 +14,19 @@ class CourseActivity < ActiveRecord::Base
|
||||||
if user_activity
|
if user_activity
|
||||||
user_activity.save
|
user_activity.save
|
||||||
else
|
else
|
||||||
user_activity = UserActivity.new
|
if self.course_act_type == 'Message' && !self.course_act.parent_id.nil?
|
||||||
user_activity.act_id = self.course_act_id
|
user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.course_act.parent.id}").first
|
||||||
user_activity.act_type = self.course_act_type
|
user_activity.created_at = self.created_at
|
||||||
user_activity.container_type = "Course"
|
user_activity.save
|
||||||
user_activity.container_id = self.course_id
|
else
|
||||||
user_activity.user_id = self.user_id
|
user_activity = UserActivity.new
|
||||||
user_activity.save
|
user_activity.act_id = self.course_act_id
|
||||||
|
user_activity.act_type = self.course_act_type
|
||||||
|
user_activity.container_type = "Course"
|
||||||
|
user_activity.container_id = self.course_id
|
||||||
|
user_activity.user_id = self.user_id
|
||||||
|
user_activity.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,19 @@ class ForgeActivity < ActiveRecord::Base
|
||||||
if user_activity
|
if user_activity
|
||||||
user_activity.save
|
user_activity.save
|
||||||
else
|
else
|
||||||
user_activity = UserActivity.new
|
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
||||||
user_activity.act_id = self.forge_act_id
|
user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.forge_act.parent.id}").first
|
||||||
user_activity.act_type = self.forge_act_type
|
user_activity.created_at = self.created_at
|
||||||
user_activity.container_type = "Project"
|
user_activity.save
|
||||||
user_activity.container_id = self.project_id
|
else
|
||||||
user_activity.save
|
user_activity = UserActivity.new
|
||||||
|
user_activity.act_id = self.forge_act_id
|
||||||
|
user_activity.act_type = self.forge_act_type
|
||||||
|
user_activity.container_type = "Project"
|
||||||
|
user_activity.container_id = self.project_id
|
||||||
|
user_activity.user_id = self.user_id
|
||||||
|
user_activity.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
43
db/schema.rb
43
db/schema.rb
|
@ -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 => 20150911031029) do
|
ActiveRecord::Schema.define(:version => 20150911064528) 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
|
||||||
|
@ -476,13 +476,6 @@ ActiveRecord::Schema.define(:version => 20150911031029) do
|
||||||
|
|
||||||
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||||
|
|
||||||
create_table "discuss_demos", :force => true do |t|
|
|
||||||
t.string "title"
|
|
||||||
t.text "body"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "documents", :force => true do |t|
|
create_table "documents", :force => true do |t|
|
||||||
t.integer "project_id", :default => 0, :null => false
|
t.integer "project_id", :default => 0, :null => false
|
||||||
t.integer "category_id", :default => 0, :null => false
|
t.integer "category_id", :default => 0, :null => false
|
||||||
|
@ -497,26 +490,23 @@ ActiveRecord::Schema.define(:version => 20150911031029) do
|
||||||
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
|
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
|
||||||
add_index "documents", ["project_id"], :name => "documents_project_id"
|
add_index "documents", ["project_id"], :name => "documents_project_id"
|
||||||
|
|
||||||
create_table "dts", :primary_key => "Num", :force => true do |t|
|
create_table "dts", :force => true do |t|
|
||||||
t.string "Defect", :limit => 50
|
t.string "IPLineCode"
|
||||||
t.string "Category", :limit => 50
|
|
||||||
t.string "File"
|
|
||||||
t.string "Method"
|
|
||||||
t.string "Module", :limit => 20
|
|
||||||
t.string "Variable", :limit => 50
|
|
||||||
t.integer "StartLine"
|
|
||||||
t.integer "IPLine"
|
|
||||||
t.string "IPLineCode", :limit => 200
|
|
||||||
t.string "Judge", :limit => 15
|
|
||||||
t.integer "Review", :limit => 1
|
|
||||||
t.string "Description"
|
t.string "Description"
|
||||||
t.text "PreConditions", :limit => 2147483647
|
t.string "Num"
|
||||||
t.text "TraceInfo", :limit => 2147483647
|
t.string "Variable"
|
||||||
t.text "Code", :limit => 2147483647
|
t.string "TraceInfo"
|
||||||
|
t.string "Method"
|
||||||
|
t.string "File"
|
||||||
|
t.string "IPLine"
|
||||||
|
t.string "Review"
|
||||||
|
t.string "Category"
|
||||||
|
t.string "Defect"
|
||||||
|
t.string "PreConditions"
|
||||||
|
t.string "StartLine"
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "id", :null => false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "enabled_modules", :force => true do |t|
|
create_table "enabled_modules", :force => true do |t|
|
||||||
|
@ -916,6 +906,7 @@ ActiveRecord::Schema.define(:version => 20150911031029) do
|
||||||
t.datetime "created_on"
|
t.datetime "created_on"
|
||||||
t.integer "comments_count", :default => 0, :null => false
|
t.integer "comments_count", :default => 0, :null => false
|
||||||
t.integer "course_id"
|
t.integer "course_id"
|
||||||
|
t.datetime "updated_on"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "news", ["author_id"], :name => "index_news_on_author_id"
|
add_index "news", ["author_id"], :name => "index_news_on_author_id"
|
||||||
|
|
Loading…
Reference in New Issue