Merge branch 'szzh' into develop
This commit is contained in:
commit
e172952b2a
|
@ -3,7 +3,7 @@ class CopyForgeActivitiesToOrgActivities < ActiveRecord::Migration
|
|||
count = ForgeActivity.all.count/30 + 1
|
||||
for i in 1 ... count do
|
||||
transaction do
|
||||
ForgeActivity.page(i).per(30).each do
|
||||
ForgeActivity.page(i).per(30).each do |forge_act|
|
||||
OrgActivity.create(:user_id => forge_act.user_id,
|
||||
:org_act_id => forge_act.forge_act_id,
|
||||
:org_act_type => forge_act.forge_act_type,
|
||||
|
|
|
@ -4,13 +4,19 @@ class CopyCourseActivitiesToOrgActivities < ActiveRecord::Migration
|
|||
for i in 1 ... count do
|
||||
transaction do
|
||||
CourseActivity.page(i).per(30).each do |course_act|
|
||||
OrgActivity.create(:user_id => course_act.user_id,
|
||||
:org_act_type => course_act.course_act_type,
|
||||
:org_act_id => course_act.course_act_id,
|
||||
:container_id => course_act.course_id,
|
||||
:container_type => "Course",
|
||||
:created_at => course_act.created_at,
|
||||
:updated_at => course_act.updated_at)
|
||||
if course_act.course_act_type == 'Message' && !course_act.course_act.parent_id.nil?
|
||||
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{course_act.course_act.parent.id}").first
|
||||
org_activity.created_at = course_act.created_at
|
||||
org_activity.save
|
||||
else
|
||||
OrgActivity.create(:user_id => course_act.user_id,
|
||||
:org_act_id => course_act.course_act_id,
|
||||
:org_act_type => course_act.course_act_type,
|
||||
:container_id => course_act.course_id,
|
||||
:container_type => 'Course',
|
||||
:created_at => course_act.created_at,
|
||||
:updated_at => course_act.updated_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue