Moved to database lookups for overview creation.
This commit is contained in:
parent
4d454289f9
commit
55f17a226b
2 changed files with 12 additions and 8 deletions
|
@ -16,7 +16,7 @@ class Ticket::State < ApplicationModel
|
|||
|
||||
list tickets by customer
|
||||
|
||||
states = Ticket::State.by_category('open') # open|closed|work_on|work_on_all|pending_reminder|pending_action|merged
|
||||
states = Ticket::State.by_category('open') # open|closed|work_on|work_on_all|viewable|pending_reminder|pending_action|merged
|
||||
|
||||
returns:
|
||||
|
||||
|
@ -45,6 +45,10 @@ returns:
|
|||
return Ticket::State.where(
|
||||
state_type_id: Ticket::StateType.where(name: ['new', 'open', 'pending reminder'])
|
||||
)
|
||||
elsif category == 'viewable'
|
||||
return Ticket::State.where(
|
||||
state_type_id: Ticket::StateType.where(name: ['new', 'open', 'pending reminder', 'pending action', 'closed', 'removed'])
|
||||
)
|
||||
elsif category == 'closed'
|
||||
return Ticket::State.where(
|
||||
state_type_id: Ticket::StateType.where(name: %w(closed))
|
||||
|
|
14
db/seeds.rb
14
db/seeds.rb
|
@ -3311,7 +3311,7 @@ Overview.create_if_not_exists(
|
|||
condition: {
|
||||
'ticket.state_id' => {
|
||||
operator: 'is',
|
||||
value: [ 1, 2, 3, 7 ],
|
||||
value: Ticket::State.by_category('open').pluck(:id),
|
||||
},
|
||||
'ticket.owner_id' => {
|
||||
operator: 'is',
|
||||
|
@ -3338,7 +3338,7 @@ Overview.create_if_not_exists(
|
|||
condition: {
|
||||
'ticket.state_id' => {
|
||||
operator: 'is',
|
||||
value: [1, 2, 3],
|
||||
value: Ticket::State.by_category('work_on_all').pluck(:id),
|
||||
},
|
||||
'ticket.owner_id' => {
|
||||
operator: 'is',
|
||||
|
@ -3365,7 +3365,7 @@ Overview.create_if_not_exists(
|
|||
condition: {
|
||||
'ticket.state_id' => {
|
||||
operator: 'is',
|
||||
value: 3,
|
||||
value: Ticket::State.by_category('pending_reminder').pluck(:id),
|
||||
},
|
||||
'ticket.owner_id' => {
|
||||
operator: 'is',
|
||||
|
@ -3397,7 +3397,7 @@ Overview.create_if_not_exists(
|
|||
condition: {
|
||||
'ticket.state_id' => {
|
||||
operator: 'is',
|
||||
value: [1, 2, 3],
|
||||
value: Ticket::State.by_category('work_on_all').pluck(:id),
|
||||
},
|
||||
},
|
||||
order: {
|
||||
|
@ -3420,7 +3420,7 @@ Overview.create_if_not_exists(
|
|||
condition: {
|
||||
'ticket.state_id' => {
|
||||
operator: 'is',
|
||||
value: [3],
|
||||
value: Ticket::State.by_category('pending_reminder').pluck(:id),
|
||||
},
|
||||
'ticket.pending_time' => {
|
||||
operator: 'within next (relative)',
|
||||
|
@ -3473,7 +3473,7 @@ Overview.create_if_not_exists(
|
|||
condition: {
|
||||
'ticket.state_id' => {
|
||||
operator: 'is',
|
||||
value: [ 1, 2, 3, 4, 6, 7 ],
|
||||
value: Ticket::State.by_category('viewable').pluck(:id),
|
||||
},
|
||||
'ticket.customer_id' => {
|
||||
operator: 'is',
|
||||
|
@ -3500,7 +3500,7 @@ Overview.create_if_not_exists(
|
|||
condition: {
|
||||
'ticket.state_id' => {
|
||||
operator: 'is',
|
||||
value: [ 1, 2, 3, 4, 6, 7 ],
|
||||
value: Ticket::State.by_category('viewable').pluck(:id),
|
||||
},
|
||||
'ticket.organization_id' => {
|
||||
operator: 'is',
|
||||
|
|
Loading…
Reference in a new issue