ticket_backlog.rb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class Report::TicketBacklog < Report::Base
  3. =begin
  4. result = Report::TicketBacklog.aggs(
  5. range_start: Time.zone.parse('2015-01-01T00:00:00Z'),
  6. range_end: Time.zone.parse('2015-12-31T23:59:59Z'),
  7. interval: 'month', # quarter, month, week, day, hour, minute, second
  8. selector: selector, # ticket selector to get only a collection of tickets
  9. timezone: 'Europe/Berlin',
  10. )
  11. returns
  12. [4,5,1,5,0,51,5,56,7,4]
  13. =end
  14. def self.aggs(params_origin)
  15. params = params_origin.dup
  16. local_params = params.clone
  17. local_params[:params] = {}
  18. local_params[:params][:field] = 'created_at'
  19. created = Report::TicketGenericTime.aggs(local_params)
  20. local_params[:params][:field] = 'close_at'
  21. closed = Report::TicketGenericTime.aggs(local_params)
  22. result = []
  23. (0..created.length - 1).each do |position|
  24. count = created[position] - closed[position]
  25. result.push count
  26. end
  27. result
  28. end
  29. =begin
  30. result = Report::TicketBacklog.items(
  31. range_start: Time.zone.parse('2015-01-01T00:00:00Z'),
  32. range_end: Time.zone.parse('2015-12-31T23:59:59Z'),
  33. selector: selector, # ticket selector to get only a collection of tickets
  34. )
  35. returns
  36. {}
  37. =end
  38. def self.items(_params)
  39. {}
  40. end
  41. end