Fixed not recognised overview sort by prio. Ignore auto generated link on create if already present.
This commit is contained in:
parent
00abecbd98
commit
6b778c27ee
3 changed files with 30 additions and 16 deletions
|
@ -7,22 +7,36 @@ class Overview < ApplicationModel
|
|||
validates :name, presence: true
|
||||
validates :prio, presence: true
|
||||
|
||||
before_create :fill_link
|
||||
before_update :fill_link
|
||||
before_create :fill_link_on_create, :fill_prio
|
||||
before_update :fill_link_on_update
|
||||
|
||||
notify_clients_support
|
||||
latest_change_support
|
||||
|
||||
private
|
||||
|
||||
# fill link
|
||||
def fill_link
|
||||
def fill_prio
|
||||
return true if prio
|
||||
prio = 9999
|
||||
end
|
||||
|
||||
def fill_link_on_create
|
||||
return true if !link.empty?
|
||||
self.link = link_name(name)
|
||||
end
|
||||
|
||||
def fill_link_on_update
|
||||
return true if link.empty?
|
||||
return true if !changes['name']
|
||||
self.link = name.downcase
|
||||
self.link = link_name(name)
|
||||
end
|
||||
|
||||
def link_name(name)
|
||||
link = name.downcase
|
||||
link.gsub!(/\s/, '_')
|
||||
link.gsub!(/[^0-9a-z]/i, '_')
|
||||
link.gsub!(/_+/, '_')
|
||||
link
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -21,9 +21,9 @@ returns
|
|||
if data[:current_user].role?('Customer')
|
||||
role = Role.find_by(name: 'Customer')
|
||||
overviews = if data[:current_user].organization_id && data[:current_user].organization.shared
|
||||
Overview.where(role_id: role.id, active: true)
|
||||
Overview.where(role_id: role.id, active: true).order(:prio)
|
||||
else
|
||||
Overview.where(role_id: role.id, organization_shared: false, active: true)
|
||||
Overview.where(role_id: role.id, organization_shared: false, active: true).order(:prio)
|
||||
end
|
||||
return overviews
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ returns
|
|||
# get agent overviews
|
||||
return if !data[:current_user].role?('Agent')
|
||||
role = Role.find_by(name: 'Agent')
|
||||
Overview.where(role_id: role.id, active: true)
|
||||
Overview.where(role_id: role.id, active: true).order(:prio)
|
||||
end
|
||||
|
||||
=begin
|
||||
|
|
|
@ -30,14 +30,14 @@ class AgentTicketOverviewLevel0Test < TestCase
|
|||
body: 'overview count test #2',
|
||||
}
|
||||
)
|
||||
click( text: 'Overviews' )
|
||||
click(text: 'Overviews')
|
||||
|
||||
# enable full overviews
|
||||
execute(
|
||||
js: '$(".content.active .sidebar").css("display", "block")',
|
||||
)
|
||||
|
||||
click( text: 'Unassigned & Open' )
|
||||
click(text: 'Unassigned & Open')
|
||||
sleep 8 # till overview is rendered
|
||||
|
||||
# select both via bulk action
|
||||
|
@ -87,7 +87,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
|||
overview_counter_before = overview_counter()
|
||||
|
||||
# click options and enable number and article count
|
||||
click( css: '.active [data-type="settings"]' )
|
||||
click(css: '.active [data-type="settings"]')
|
||||
|
||||
watch_for(
|
||||
css: '.modal h1',
|
||||
|
@ -111,7 +111,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
|||
check(
|
||||
css: '.modal input[value="article_count"]',
|
||||
)
|
||||
click( css: '.modal .js-submit' )
|
||||
click(css: '.modal .js-submit')
|
||||
sleep 4
|
||||
|
||||
# check if number and article count is shown
|
||||
|
@ -147,7 +147,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
|||
)
|
||||
|
||||
# disable number and article count
|
||||
click( css: '.active [data-type="settings"]' )
|
||||
click(css: '.active [data-type="settings"]')
|
||||
|
||||
watch_for(
|
||||
css: '.modal h1',
|
||||
|
@ -159,7 +159,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
|||
uncheck(
|
||||
css: '.modal input[value="article_count"]',
|
||||
)
|
||||
click( css: '.modal .js-submit' )
|
||||
click(css: '.modal .js-submit')
|
||||
sleep 2
|
||||
|
||||
# check if number and article count is gone
|
||||
|
@ -188,7 +188,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
|||
|
||||
# get new overview count
|
||||
overview_counter_new = overview_counter()
|
||||
assert_equal( overview_counter_before['#ticket/view/all_unassigned'] + 1, overview_counter_new['#ticket/view/all_unassigned'] )
|
||||
assert_equal(overview_counter_before['#ticket/view/all_unassigned'] + 1, overview_counter_new['#ticket/view/all_unassigned'])
|
||||
|
||||
# open ticket by search
|
||||
ticket_open_by_search(
|
||||
|
@ -206,7 +206,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
|||
|
||||
# get current overview count
|
||||
overview_counter_after = overview_counter()
|
||||
assert_equal( overview_counter_before['#ticket/view/all_unassigned'], overview_counter_after['#ticket/view/all_unassigned'] )
|
||||
assert_equal(overview_counter_before['#ticket/view/all_unassigned'], overview_counter_after['#ticket/view/all_unassigned'])
|
||||
|
||||
# cleanup
|
||||
tasks_close_all()
|
||||
|
|
Loading…
Reference in a new issue