ticket_backlog.rb 1.2 KB

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