fixed issue#314

This commit is contained in:
yanxd 2013-10-17 16:14:35 +08:00
parent 081a8e9825
commit ab5d8853b5
1 changed files with 5 additions and 4 deletions

View File

@ -148,9 +148,10 @@ class UsersController < ApplicationController
end end
end end
# added by fq # added by fq, modify by nyan
def user_courses def user_courses
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)).reverse @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
@membership.sort! {|older, newer| newer.created_on <=> older.created_on }
case params[:type] case params[:type]
when "2" when "2"
#@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) #@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
@ -259,7 +260,7 @@ class UsersController < ApplicationController
@user_pages = Paginator.new @user_count, @limit, params['page'] @user_pages = Paginator.new @user_count, @limit, params['page']
#@offset ||= @user_pages.offset #@offset ||= @user_pages.offset
#@users = scope.order(sort_clause).limit(@limit).offset(@offset).all #@users = scope.order(sort_clause).limit(@limit).offset(@offset).all
@user_base_tag = params[:id]?'base_users':'base' @user_base_tag = params[:id] ? 'base_users':'base'
if params[:user_sort_type].present? if params[:user_sort_type].present?
case params[:user_sort_type] case params[:user_sort_type]
when '0' when '0'
@ -355,7 +356,7 @@ class UsersController < ApplicationController
scope = scope.like(params[:name]) if params[:name].present? scope = scope.like(params[:name]) if params[:name].present?
@user_count = scope.count @user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page'] @user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id]?'base_users':'base' @user_base_tag = params[:id] ? 'base_users':'base'
@offset ||= @user_pages.reverse_offset @offset ||= @user_pages.reverse_offset
unless @offset == 0 unless @offset == 0
@users = scope.offset(@offset).limit(@limit).all.reverse @users = scope.offset(@offset).limit(@limit).all.reverse