Fixed ticket selector if user ist not set.
This commit is contained in:
parent
9469409cde
commit
8015303032
2 changed files with 8 additions and 8 deletions
|
@ -486,7 +486,7 @@ condition example
|
||||||
if selector['operator'] == 'is'
|
if selector['operator'] == 'is'
|
||||||
if selector['pre_condition'] == 'not_set'
|
if selector['pre_condition'] == 'not_set'
|
||||||
if attributes[1] =~ /^(created_by|updated_by|owner|customer|user)_id/
|
if attributes[1] =~ /^(created_by|updated_by|owner|customer|user)_id/
|
||||||
query += "#{attribute} NOT IN (?)"
|
query += "#{attribute} IN (?)"
|
||||||
bind_params.push 1
|
bind_params.push 1
|
||||||
else
|
else
|
||||||
query += "#{attribute} IS NOT NULL"
|
query += "#{attribute} IS NOT NULL"
|
||||||
|
@ -513,7 +513,7 @@ condition example
|
||||||
elsif selector['operator'] == 'is not'
|
elsif selector['operator'] == 'is not'
|
||||||
if selector['pre_condition'] == 'not_set'
|
if selector['pre_condition'] == 'not_set'
|
||||||
if attributes[1] =~ /^(created_by|updated_by|owner|customer|user)_id/
|
if attributes[1] =~ /^(created_by|updated_by|owner|customer|user)_id/
|
||||||
query += "#{attribute} IN (?)"
|
query += "#{attribute} NOT IN (?)"
|
||||||
bind_params.push 1
|
bind_params.push 1
|
||||||
else
|
else
|
||||||
query += "#{attribute} IS NULL"
|
query += "#{attribute} IS NULL"
|
||||||
|
|
|
@ -776,16 +776,16 @@ class TicketSelectorTest < ActiveSupport::TestCase
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
ticket_count, tickets = Ticket.selectors(condition, 10, agent1)
|
ticket_count, tickets = Ticket.selectors(condition, 10, agent1)
|
||||||
assert_equal(ticket_count, 1)
|
assert_equal(ticket_count, 2)
|
||||||
|
|
||||||
ticket_count, tickets = Ticket.selectors(condition, 10, agent2)
|
ticket_count, tickets = Ticket.selectors(condition, 10, agent2)
|
||||||
assert_equal(ticket_count, 0)
|
assert_equal(ticket_count, 0)
|
||||||
|
|
||||||
ticket_count, tickets = Ticket.selectors(condition, 10, customer1)
|
ticket_count, tickets = Ticket.selectors(condition, 10, customer1)
|
||||||
assert_equal(ticket_count, 1)
|
assert_equal(ticket_count, 0)
|
||||||
|
|
||||||
ticket_count, tickets = Ticket.selectors(condition, 10, customer2)
|
ticket_count, tickets = Ticket.selectors(condition, 10, customer2)
|
||||||
assert_equal(ticket_count, 0)
|
assert_equal(ticket_count, 2)
|
||||||
|
|
||||||
condition = {
|
condition = {
|
||||||
'ticket.group_id' => {
|
'ticket.group_id' => {
|
||||||
|
@ -798,16 +798,16 @@ class TicketSelectorTest < ActiveSupport::TestCase
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
ticket_count, tickets = Ticket.selectors(condition, 10, agent1)
|
ticket_count, tickets = Ticket.selectors(condition, 10, agent1)
|
||||||
assert_equal(ticket_count, 2)
|
assert_equal(ticket_count, 1)
|
||||||
|
|
||||||
ticket_count, tickets = Ticket.selectors(condition, 10, agent2)
|
ticket_count, tickets = Ticket.selectors(condition, 10, agent2)
|
||||||
assert_equal(ticket_count, 0)
|
assert_equal(ticket_count, 0)
|
||||||
|
|
||||||
ticket_count, tickets = Ticket.selectors(condition, 10, customer1)
|
ticket_count, tickets = Ticket.selectors(condition, 10, customer1)
|
||||||
assert_equal(ticket_count, 0)
|
assert_equal(ticket_count, 1)
|
||||||
|
|
||||||
ticket_count, tickets = Ticket.selectors(condition, 10, customer2)
|
ticket_count, tickets = Ticket.selectors(condition, 10, customer2)
|
||||||
assert_equal(ticket_count, 2)
|
assert_equal(ticket_count, 0)
|
||||||
|
|
||||||
UserInfo.current_user_id = agent1.id
|
UserInfo.current_user_id = agent1.id
|
||||||
condition = {
|
condition = {
|
||||||
|
|
Loading…
Reference in a new issue