@ -784,11 +800,13 @@ class UsersController < ApplicationController
@user_activities=UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page*10)
when"project_message"
@user_activities=UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page*10)
when"current_user"
@user_activities=UserActivity.where("user_id = #{User.current.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page*10)
else
@user_activities=UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page*10)
@user_activities=UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page*10)
end
else
@user_activities=UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page*10)
@user_activities=UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page*10)
memos=Memo.where('author_id = ? AND parent_id IS NOT NULL',user.id)
memos.eachdo|m|
ifMemo.find(m.parent_id).author.id!=user.id
issue_c=issue_c+1
@ -35,18 +35,18 @@ module UserScoreHelper
issue_c=issue_c-1
end
end
pmemos=Memo.where('author_id = ? AND parent_id IS NULL',user.id)
pmemos.eachdo|pm|
issue_c=issue_c+pm.replies_count
end
############################
issue_c=issue_c+JournalsForMessage.where('user_id = ? AND reply_id IS NOT NULL AND reply_id <> ?',user.id,user.id).count+JournalsForMessage.where('reply_id = ? AND user_id <> ?',user.id,user.id).count