个人主页3080账户动态异常bug

This commit is contained in:
cxt 2015-08-29 16:39:37 +08:00
parent 244d5165e2
commit 5ddefe21b8
2 changed files with 6 additions and 4 deletions

View File

@ -627,14 +627,15 @@ class UsersController < ApplicationController
end
def show
@page = params[:page] ? params[:page].to_i + 1 : 0
@type = params[:type]
user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")"
user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
course_types = "('Message','News','HomeworkCommon','poll')"
project_types = "('Message','Issue')"
if @type
case @type
if params[:type].present?
case params[:type]
when "course_homework"
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('created_at desc').limit(10).offset(@page * 10)
when "course_news"
@ -654,6 +655,7 @@ class UsersController < ApplicationController
@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
# @user_activities = paginateHelper @user_activities,500
@type = params[:type]
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}

View File

@ -14,7 +14,7 @@
$(window).scroll(scrollHandler);
</script>
<input type="hidden" value="<%= @type%>" id="user_activities_type">
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="resources">
<div class="homepageRightBanner">
<div class="NewsBannerName">最新动态</div>