|
|
|
@ -46,12 +46,15 @@ class ForgeActivity < ActiveRecord::Base
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def add_org_activity
|
|
|
|
|
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
|
|
|
|
|
if org_activity
|
|
|
|
|
org_activity.created_at = self.created_at
|
|
|
|
|
org_activity.save
|
|
|
|
|
else
|
|
|
|
|
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
|
|
|
|
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
|
|
|
|
|
if org_activity
|
|
|
|
|
org_activity.created_at = self.created_at
|
|
|
|
|
org_activity.save
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
OrgActivity.create(:user_id => self.user_id,
|
|
|
|
|
:org_act_id => self.forge_act_id,
|
|
|
|
@ -62,6 +65,7 @@ class ForgeActivity < ActiveRecord::Base
|
|
|
|
|
:updated_at => self.updated_at)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def destroy_user_activity
|
|
|
|
|
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'")
|
|
|
|
|