GRN2-277: Optimize server recordings to make it useable for large deployments (#2411)

* First changes to server recordings

* Update server recordings

* Rubocop

* Make sure to return nothing for empty searches

* Made sure exactly the right amount of recordings are returned

* Added test cases
This commit is contained in:
Ahmad Farhat
2021-01-12 17:36:51 -05:00
committed by GitHub
parent 9cd08dab54
commit 2b0a80c7eb
13 changed files with 102 additions and 15 deletions

View File

@ -51,7 +51,7 @@ class Room < ApplicationRecord
# Rely on manual ordering if trying to sort by status
return order_by_status(table, running_ids) if column == "status"
return table.order("COALESCE(rooms.last_session,rooms.created_at) DESC") if column == "created_at"
return table.order(Arel.sql("COALESCE(rooms.last_session,rooms.created_at) DESC")) if column == "created_at"
return table.order(Arel.sql("rooms.#{column} #{direction}")) if table.column_names.include?(column)