Improved api, removed not needed attribute.
This commit is contained in:
parent
79ba2dd4be
commit
bea2a732e8
3 changed files with 14 additions and 17 deletions
|
@ -329,7 +329,6 @@ class TicketsController < ApplicationController
|
||||||
query: params[:term],
|
query: params[:term],
|
||||||
condition: params[:condition],
|
condition: params[:condition],
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
detail: params[:detail]
|
|
||||||
)
|
)
|
||||||
assets = {}
|
assets = {}
|
||||||
ticket_result = []
|
ticket_result = []
|
||||||
|
@ -372,10 +371,8 @@ class TicketsController < ApplicationController
|
||||||
}
|
}
|
||||||
user_tickets_open = Ticket.search(
|
user_tickets_open = Ticket.search(
|
||||||
limit: limit,
|
limit: limit,
|
||||||
#:query => params[:term],
|
|
||||||
condition: condition,
|
condition: condition,
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
detail: true,
|
|
||||||
)
|
)
|
||||||
user_tickets_open_ids = assets_of_tickets(user_tickets_open, assets)
|
user_tickets_open_ids = assets_of_tickets(user_tickets_open, assets)
|
||||||
|
|
||||||
|
@ -386,10 +383,8 @@ class TicketsController < ApplicationController
|
||||||
}
|
}
|
||||||
user_tickets_closed = Ticket.search(
|
user_tickets_closed = Ticket.search(
|
||||||
limit: limit,
|
limit: limit,
|
||||||
#:query => params[:term],
|
|
||||||
condition: condition,
|
condition: condition,
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
detail: true,
|
|
||||||
)
|
)
|
||||||
user_tickets_closed_ids = assets_of_tickets(user_tickets_closed, assets)
|
user_tickets_closed_ids = assets_of_tickets(user_tickets_closed, assets)
|
||||||
|
|
||||||
|
@ -438,10 +433,8 @@ class TicketsController < ApplicationController
|
||||||
}
|
}
|
||||||
org_tickets_open = Ticket.search(
|
org_tickets_open = Ticket.search(
|
||||||
limit: limit,
|
limit: limit,
|
||||||
#:query => params[:term],
|
|
||||||
condition: condition,
|
condition: condition,
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
detail: true,
|
|
||||||
)
|
)
|
||||||
org_tickets_open_ids = assets_of_tickets(org_tickets_open, assets)
|
org_tickets_open_ids = assets_of_tickets(org_tickets_open, assets)
|
||||||
|
|
||||||
|
@ -452,10 +445,8 @@ class TicketsController < ApplicationController
|
||||||
}
|
}
|
||||||
org_tickets_closed = Ticket.search(
|
org_tickets_closed = Ticket.search(
|
||||||
limit: limit,
|
limit: limit,
|
||||||
#:query => params[:term],
|
|
||||||
condition: condition,
|
condition: condition,
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
detail: true,
|
|
||||||
)
|
)
|
||||||
org_tickets_closed_ids = assets_of_tickets(org_tickets_closed, assets)
|
org_tickets_closed_ids = assets_of_tickets(org_tickets_closed, assets)
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ search tickets via search index
|
||||||
:current_user => User.find(123),
|
:current_user => User.find(123),
|
||||||
:query => 'search something',
|
:query => 'search something',
|
||||||
:limit => 15,
|
:limit => 15,
|
||||||
:full => 0
|
:full => false,
|
||||||
)
|
)
|
||||||
|
|
||||||
returns
|
returns
|
||||||
|
@ -33,10 +33,19 @@ search tickets via database
|
||||||
|
|
||||||
result = Ticket.search(
|
result = Ticket.search(
|
||||||
:current_user => User.find(123),
|
:current_user => User.find(123),
|
||||||
:condition => '',
|
:condition => {
|
||||||
:detail => true,
|
'tickets.owner_id' => user.id,
|
||||||
|
'tickets.state_id' => Ticket::State.where(
|
||||||
|
state_type_id: Ticket::StateType.where(
|
||||||
|
name: [
|
||||||
|
'pending reminder',
|
||||||
|
'pending action',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
},
|
||||||
:limit => 15,
|
:limit => 15,
|
||||||
:full => 0
|
:full => false,
|
||||||
)
|
)
|
||||||
|
|
||||||
returns
|
returns
|
||||||
|
@ -57,7 +66,7 @@ returns
|
||||||
end
|
end
|
||||||
|
|
||||||
# try search index backend
|
# try search index backend
|
||||||
if !params[:detail] && SearchIndexBackend.enabled?
|
if !params[:condition] && SearchIndexBackend.enabled?
|
||||||
query_extention = {}
|
query_extention = {}
|
||||||
query_extention['bool'] = {}
|
query_extention['bool'] = {}
|
||||||
query_extention['bool']['must'] = []
|
query_extention['bool']['must'] = []
|
||||||
|
|
|
@ -16,7 +16,6 @@ module ICal::Ticket
|
||||||
tickets = Ticket.search(
|
tickets = Ticket.search(
|
||||||
current_user: user,
|
current_user: user,
|
||||||
condition: condition,
|
condition: condition,
|
||||||
detail: true,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
events_data = []
|
events_data = []
|
||||||
|
@ -52,7 +51,6 @@ module ICal::Ticket
|
||||||
tickets = Ticket.search(
|
tickets = Ticket.search(
|
||||||
current_user: user,
|
current_user: user,
|
||||||
condition: condition,
|
condition: condition,
|
||||||
detail: true,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
events_data = []
|
events_data = []
|
||||||
|
@ -83,7 +81,6 @@ module ICal::Ticket
|
||||||
tickets = Ticket.search(
|
tickets = Ticket.search(
|
||||||
current_user: user,
|
current_user: user,
|
||||||
condition: condition,
|
condition: condition,
|
||||||
detail: true,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
events_data = []
|
events_data = []
|
||||||
|
|
Loading…
Reference in a new issue