Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
d8fc783b
Commit
d8fc783b
authored
Aug 15, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove useless increment when creating a new board list
parent
847ebce9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
9 deletions
+2
-9
app/services/boards/lists/create_service.rb
app/services/boards/lists/create_service.rb
+2
-9
No files found.
app/services/boards/lists/create_service.rb
View file @
d8fc783b
...
@@ -3,15 +3,13 @@ module Boards
...
@@ -3,15 +3,13 @@ module Boards
class
CreateService
<
Boards
::
BaseService
class
CreateService
<
Boards
::
BaseService
def
execute
def
execute
List
.
transaction
do
List
.
transaction
do
position
=
find_next_position
create_list_at
(
next_position
)
increment_higher_lists
(
position
)
create_list_at
(
position
)
end
end
end
end
private
private
def
find_
next_position
def
next_position
max_position
=
board
.
lists
.
label
.
maximum
(
:position
)
max_position
=
board
.
lists
.
label
.
maximum
(
:position
)
max_position
.
nil?
?
0
:
max_position
.
succ
max_position
.
nil?
?
0
:
max_position
.
succ
end
end
...
@@ -19,11 +17,6 @@ module Boards
...
@@ -19,11 +17,6 @@ module Boards
def
create_list_at
(
position
)
def
create_list_at
(
position
)
board
.
lists
.
create
(
params
.
merge
(
list_type: :label
,
position:
position
))
board
.
lists
.
create
(
params
.
merge
(
list_type: :label
,
position:
position
))
end
end
def
increment_higher_lists
(
position
)
board
.
lists
.
label
.
where
(
'position >= ?'
,
position
)
.
update_all
(
'position = position + 1'
)
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment