trabajo-afectivo/lib/report/ticket_backlog.rb

60 lines
1.3 KiB
Ruby
Raw Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
2015-10-29 09:07:45 +00:00
class Report::TicketBacklog < Report::Base
=begin
result = Report::TicketBacklog.aggs(
range_start: Time.zone.parse('2015-01-01T00:00:00Z'),
range_end: Time.zone.parse('2015-12-31T23:59:59Z'),
2015-10-29 09:07:45 +00:00
interval: 'month', # quarter, month, week, day, hour, minute, second
selector: selector, # ticket selector to get only a collection of tickets
timezone: 'Europe/Berlin',
2015-10-29 09:07:45 +00:00
)
returns
[4,5,1,5,0,51,5,56,7,4]
=end
def self.aggs(params_origin)
params = params_origin.dup
2015-10-29 09:07:45 +00:00
local_params = params.clone
local_params[:params] = {}
local_params[:params][:field] = 'created_at'
created = Report::TicketGenericTime.aggs(local_params)
local_params[:params][:field] = 'close_at'
2015-10-29 09:07:45 +00:00
closed = Report::TicketGenericTime.aggs(local_params)
result = []
(0..created.length - 1).each do |position|
2015-10-29 09:07:45 +00:00
count = created[position] - closed[position]
result.push count
end
2015-10-29 09:07:45 +00:00
result
end
=begin
result = Report::TicketBacklog.items(
range_start: Time.zone.parse('2015-01-01T00:00:00Z'),
range_end: Time.zone.parse('2015-12-31T23:59:59Z'),
2015-10-29 09:07:45 +00:00
selector: selector, # ticket selector to get only a collection of tickets
)
returns
{}
=end
def self.items(_params)
{}
end
end