Improved related ticket, if we do not have open related tickets, search for any tickets of the customer.
This commit is contained in:
parent
3306cf4e8a
commit
8051c1c741
1 changed files with 12 additions and 0 deletions
|
@ -201,6 +201,18 @@ class TicketsController < ApplicationController
|
||||||
.order('created_at DESC')
|
.order('created_at DESC')
|
||||||
.limit(6)
|
.limit(6)
|
||||||
|
|
||||||
|
# if we do not have open related tickets, search for any tickets
|
||||||
|
if ticket_lists.empty?
|
||||||
|
ticket_lists = Ticket
|
||||||
|
.where(
|
||||||
|
customer_id: ticket.customer_id,
|
||||||
|
)
|
||||||
|
.where(access_condition)
|
||||||
|
.where('id != ?', [ ticket.id ])
|
||||||
|
.order('created_at DESC')
|
||||||
|
.limit(6)
|
||||||
|
end
|
||||||
|
|
||||||
# get related assets
|
# get related assets
|
||||||
ticket_ids_by_customer = []
|
ticket_ids_by_customer = []
|
||||||
ticket_lists.each {|ticket_list|
|
ticket_lists.each {|ticket_list|
|
||||||
|
|
Loading…
Reference in a new issue