mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 20:18:08 +00:00
fix: unattended count mismatch in report and list (#7263)
This commit is contained in:
@@ -96,10 +96,9 @@ class V2::ReportBuilder
|
|||||||
|
|
||||||
def conversations
|
def conversations
|
||||||
@open_conversations = scope.conversations.where(account_id: @account.id).open
|
@open_conversations = scope.conversations.where(account_id: @account.id).open
|
||||||
first_response_count = @account.reporting_events.where(name: 'first_response', conversation_id: @open_conversations.pluck('id')).count
|
|
||||||
metric = {
|
metric = {
|
||||||
open: @open_conversations.count,
|
open: @open_conversations.count,
|
||||||
unattended: @open_conversations.count - first_response_count
|
unattended: @open_conversations.unattended.count
|
||||||
}
|
}
|
||||||
metric[:unassigned] = @open_conversations.unassigned.count if params[:type].equal?(:account)
|
metric[:unassigned] = @open_conversations.unassigned.count if params[:type].equal?(:account)
|
||||||
metric
|
metric
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class ConversationFinder
|
|||||||
when 'participating'
|
when 'participating'
|
||||||
@conversations = current_user.participating_conversations.where(account_id: current_account.id)
|
@conversations = current_user.participating_conversations.where(account_id: current_account.id)
|
||||||
when 'unattended'
|
when 'unattended'
|
||||||
@conversations = @conversations.where(first_reply_created_at: nil)
|
@conversations = @conversations.unattended
|
||||||
end
|
end
|
||||||
@conversations
|
@conversations
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ class Conversation < ApplicationRecord
|
|||||||
scope :unassigned, -> { where(assignee_id: nil) }
|
scope :unassigned, -> { where(assignee_id: nil) }
|
||||||
scope :assigned, -> { where.not(assignee_id: nil) }
|
scope :assigned, -> { where.not(assignee_id: nil) }
|
||||||
scope :assigned_to, ->(agent) { where(assignee_id: agent.id) }
|
scope :assigned_to, ->(agent) { where(assignee_id: agent.id) }
|
||||||
|
scope :unattended, -> { where(first_reply_created_at: nil) }
|
||||||
scope :resolvable, lambda { |auto_resolve_duration|
|
scope :resolvable, lambda { |auto_resolve_duration|
|
||||||
return none if auto_resolve_duration.to_i.zero?
|
return none if auto_resolve_duration.to_i.zero?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user