Improved api, removed not needed attribute.

This commit is contained in:
Martin Edenhofer 2015-06-22 21:32:29 +02:00
parent 79ba2dd4be
commit bea2a732e8
3 changed files with 14 additions and 17 deletions

View file

@ -329,7 +329,6 @@ class TicketsController < ApplicationController
query: params[:term],
condition: params[:condition],
current_user: current_user,
detail: params[:detail]
)
assets = {}
ticket_result = []
@ -372,10 +371,8 @@ class TicketsController < ApplicationController
}
user_tickets_open = Ticket.search(
limit: limit,
#:query => params[:term],
condition: condition,
current_user: current_user,
detail: true,
)
user_tickets_open_ids = assets_of_tickets(user_tickets_open, assets)
@ -386,10 +383,8 @@ class TicketsController < ApplicationController
}
user_tickets_closed = Ticket.search(
limit: limit,
#:query => params[:term],
condition: condition,
current_user: current_user,
detail: true,
)
user_tickets_closed_ids = assets_of_tickets(user_tickets_closed, assets)
@ -438,10 +433,8 @@ class TicketsController < ApplicationController
}
org_tickets_open = Ticket.search(
limit: limit,
#:query => params[:term],
condition: condition,
current_user: current_user,
detail: true,
)
org_tickets_open_ids = assets_of_tickets(org_tickets_open, assets)
@ -452,10 +445,8 @@ class TicketsController < ApplicationController
}
org_tickets_closed = Ticket.search(
limit: limit,
#:query => params[:term],
condition: condition,
current_user: current_user,
detail: true,
)
org_tickets_closed_ids = assets_of_tickets(org_tickets_closed, assets)

View file

@ -22,7 +22,7 @@ search tickets via search index
:current_user => User.find(123),
:query => 'search something',
:limit => 15,
:full => 0
:full => false,
)
returns
@ -33,10 +33,19 @@ search tickets via database
result = Ticket.search(
:current_user => User.find(123),
:condition => '',
:detail => true,
:condition => {
'tickets.owner_id' => user.id,
'tickets.state_id' => Ticket::State.where(
state_type_id: Ticket::StateType.where(
name: [
'pending reminder',
'pending action',
],
),
),
},
:limit => 15,
:full => 0
:full => false,
)
returns
@ -57,7 +66,7 @@ returns
end
# try search index backend
if !params[:detail] && SearchIndexBackend.enabled?
if !params[:condition] && SearchIndexBackend.enabled?
query_extention = {}
query_extention['bool'] = {}
query_extention['bool']['must'] = []

View file

@ -16,7 +16,6 @@ module ICal::Ticket
tickets = Ticket.search(
current_user: user,
condition: condition,
detail: true,
)
events_data = []
@ -52,7 +51,6 @@ module ICal::Ticket
tickets = Ticket.search(
current_user: user,
condition: condition,
detail: true,
)
events_data = []
@ -83,7 +81,6 @@ module ICal::Ticket
tickets = Ticket.search(
current_user: user,
condition: condition,
detail: true,
)
events_data = []