Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #5013 - Dashboard „REOPENING RATE“ statistic shows nothing.
Co-authored-by: Florian Liebe <fl@zammad.com>
- Loading branch information
1 parent
9cc958b
commit c0e25c8
Showing
4 changed files
with
25 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
spec/models/ticket/calls_stats_ticket_reopen_log_examples.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'Ticket::CallsStatsTicketReopenLog' do | ||
let(:agent) { create(:agent, groups: Group.all) } | ||
let(:ticket) { create(:ticket, group: Group.first, owner: agent) } | ||
|
||
it 'does track reopened tickets' do | ||
ticket.update(state: Ticket::State.find_by(name: 'closed')) | ||
ticket.update(state: Ticket::State.find_by(name: 'open')) | ||
expect(StatsStore.find_by(key: 'ticket:reopen', stats_storable_type: 'User', stats_storable_id: agent.id).data).to eq({ 'ticket_id'=> ticket.id }) | ||
end | ||
|
||
it 'does calculate dashboard correctly' do | ||
create_list(:ticket, 8, group: Group.first, owner: agent, state: Ticket::State.find_by(name: 'closed')) | ||
tickets_reopened = create_list(:ticket, 2, group: Group.first, owner: agent, state: Ticket::State.find_by(name: 'closed')) | ||
tickets_reopened.each { |ticket| ticket.update(state: Ticket::State.find_by(name: 'open')) } | ||
|
||
Stats.generate | ||
expect(StatsStore.find_by(key: 'dashboard', stats_storable_type: 'User', stats_storable_id: agent.id).data['StatsTicketReopen']).to eq({ 'used_for_average' => 20.0, 'percent' => 20.0, 'average_per_agent' => 20.0, 'state' => 'good', 'count' => 2, 'total' => 10 }) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters