From ab5d8853b5eed12174db8238b99814a7155d7707 Mon Sep 17 00:00:00 2001 From: yanxd Date: Thu, 17 Oct 2013 16:14:35 +0800 Subject: [PATCH] fixed issue#314 --- app/controllers/users_controller.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 01347a571..f9d4a30ea 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -148,9 +148,10 @@ class UsersController < ApplicationController end end - # added by fq + # added by fq, modify by nyan 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] when "2" #@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'] #@offset ||= @user_pages.offset #@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? case params[:user_sort_type] when '0' @@ -355,7 +356,7 @@ class UsersController < ApplicationController scope = scope.like(params[:name]) if params[:name].present? @user_count = scope.count @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 unless @offset == 0 @users = scope.offset(@offset).limit(@limit).all.reverse