fix: Use last_activity_at instead of updated_at for sorting (#1281)

Co-authored-by: Akash Srivastava <akash.srivastava.1911@gmail.com>
This commit is contained in:
Pranav Raj S
2020-10-05 22:52:43 +05:30
committed by GitHub
parent ee119b2174
commit 399f9e004a
11 changed files with 56 additions and 7 deletions

View File

@@ -7,6 +7,7 @@
# agent_last_seen_at :datetime
# contact_last_seen_at :datetime
# identifier :string
# last_activity_at :datetime not null
# locked :boolean default(FALSE)
# status :integer default("open"), not null
# uuid :uuid not null
@@ -36,7 +37,7 @@ class Conversation < ApplicationRecord
enum status: { open: 0, resolved: 1, bot: 2 }
scope :latest, -> { order(updated_at: :desc) }
scope :latest, -> { order(last_activity_at: :desc) }
scope :unassigned, -> { where(assignee_id: nil) }
scope :assigned_to, ->(agent) { where(assignee_id: agent.id) }