Fixed issue #2246 - Records in Reporting not updated when single ActiveRecord can not be found (fixes #2246)
This commit is contained in:
parent
58a8c047bb
commit
5ff371f51b
2 changed files with 44 additions and 2 deletions
|
@ -169,8 +169,10 @@ returns
|
||||||
|
|
||||||
assets = {}
|
assets = {}
|
||||||
result[:ticket_ids].each do |ticket_id|
|
result[:ticket_ids].each do |ticket_id|
|
||||||
ticket_full = Ticket.find(ticket_id)
|
suppress(ActiveRecord::RecordNotFound) do
|
||||||
assets = ticket_full.assets(assets)
|
ticket_full = Ticket.find(ticket_id)
|
||||||
|
assets = ticket_full.assets(assets)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
result[:assets] = assets
|
result[:assets] = assets
|
||||||
result
|
result
|
||||||
|
|
40
spec/lib/report/ticket_generic_time_spec.rb
Normal file
40
spec/lib/report/ticket_generic_time_spec.rb
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Report::TicketGenericTime do
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
|
result = Report::TicketGenericTime.items(
|
||||||
|
range_start: '2015-01-01T00:00:00Z',
|
||||||
|
range_end: '2015-12-31T23:59:59Z',
|
||||||
|
selector: selector, # ticket selector to get only a collection of tickets
|
||||||
|
params: { field: 'created_at' },
|
||||||
|
)
|
||||||
|
|
||||||
|
returns
|
||||||
|
|
||||||
|
{
|
||||||
|
count: 123,
|
||||||
|
ticket_ids: [4,5,1,5,0,51,5,56,7,4],
|
||||||
|
assets: assets,
|
||||||
|
}
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
describe 'items' do
|
||||||
|
|
||||||
|
# Regression test for issue #2246 - Records in Reporting not updated when single ActiveRecord can not be found
|
||||||
|
it 'correctly handles missing tickets' do
|
||||||
|
class_double('SearchIndexBackend', selectors: { ticket_ids: [-1] } ).as_stubbed_const
|
||||||
|
|
||||||
|
expect do
|
||||||
|
described_class.items(
|
||||||
|
range_start: '2015-01-01T00:00:00Z',
|
||||||
|
range_end: '2015-12-31T23:59:59Z',
|
||||||
|
selector: {}, # ticket selector to get only a collection of tickets
|
||||||
|
params: { field: 'created_at' },
|
||||||
|
)
|
||||||
|
end.to_not raise_error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue