results = Ticket::TimeAccounting
      .where(created_at: (start_period..end_period))
      .pluck(:ticket_id, :time_unit, :created_by_id)
      .each_with_object({}) do |record, memo|
        memo[record[0]] ||= {