GRN2-xx: Fixed issue with rooms not being ordered correctly (#897)

* Fixed issue with rooms not being ordered correctly

* removed home room from list

Co-authored-by: Jesus Federico <jesus@123it.ca>
This commit is contained in:
Ahmad Farhat 2020-01-08 10:34:01 -05:00 committed by Jesus Federico
parent 4476245f29
commit ebff9d3625
1 changed files with 2 additions and 4 deletions

View File

@ -131,10 +131,8 @@ class User < ApplicationRecord
# Retrives a list of all a users rooms that are not the main room, sorted by last session date.
def secondary_rooms
secondary = (rooms - [main_room])
no_session, session = secondary.partition { |r| r.last_session.nil? }
sorted = session.sort_by(&:last_session)
sorted + no_session
room_list = rooms.where.not(uid: main_room.uid)
room_list.where.not(last_session: nil).order("last_session desc") + room_list.where(last_session: nil)
end
def name_chunk