forked from External/greenlight
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:
parent
4476245f29
commit
ebff9d3625
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue