forked from External/greenlight
Fixed order of rooms in postgres (#979)
Co-authored-by: Jesus Federico <jesus@123it.ca>
This commit is contained in:
parent
037e4f1c43
commit
43911b9fd5
|
@ -103,9 +103,9 @@ class User < ApplicationRecord
|
|||
order(Arel.sql("#{column} #{direction}"))
|
||||
end
|
||||
|
||||
# Returns a list of rooms ordered by last session
|
||||
# Returns a list of rooms ordered by last session (with nil rooms last)
|
||||
def ordered_rooms
|
||||
[main_room] + rooms.where.not(id: main_room.id).order("last_session desc")
|
||||
[main_room] + rooms.where.not(id: main_room.id).order(Arel.sql("last_session IS NULL, last_session desc"))
|
||||
end
|
||||
|
||||
# Activates an account and initialize a users main room
|
||||
|
|
Loading…
Reference in New Issue