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
Tatuya Kamada
gitlab-ce
Commits
34bf798e
Commit
34bf798e
authored
Feb 27, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Issue ordering] Using integer instead of float
parent
69e0b06d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
app/models/concerns/relative_positioning.rb
app/models/concerns/relative_positioning.rb
+3
-3
db/migrate/20170131221752_add_relative_position_to_issues.rb
db/migrate/20170131221752_add_relative_position_to_issues.rb
+1
-1
db/schema.rb
db/schema.rb
+1
-1
No files found.
app/models/concerns/relative_positioning.rb
View file @
34bf798e
module
RelativePositioning
module
RelativePositioning
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
MIN_POSITION
=
Float
::
MIN
MIN_POSITION
=
0
MAX_POSITION
=
Float
::
MAX
MAX_POSITION
=
Gitlab
::
Database
::
MAX_INT_VALUE
included
do
included
do
after_save
:save_positionable_neighbours
after_save
:save_positionable_neighbours
...
@@ -120,7 +120,7 @@ module RelativePositioning
...
@@ -120,7 +120,7 @@ module RelativePositioning
def
position_between
(
pos_before
,
pos_after
)
def
position_between
(
pos_before
,
pos_after
)
pos_before
,
pos_after
=
[
pos_before
,
pos_after
].
sort
pos_before
,
pos_after
=
[
pos_before
,
pos_after
].
sort
rand
(
pos_before
.
next
_float
..
pos_after
.
prev_float
)
rand
(
pos_before
.
next
..
pos_after
.
pred
)
end
end
def
save_positionable_neighbours
def
save_positionable_neighbours
...
...
db/migrate/20170131221752_add_relative_position_to_issues.rb
View file @
34bf798e
...
@@ -24,7 +24,7 @@ class AddRelativePositionToIssues < ActiveRecord::Migration
...
@@ -24,7 +24,7 @@ class AddRelativePositionToIssues < ActiveRecord::Migration
# disable_ddl_transaction!
# disable_ddl_transaction!
def
change
def
change
add_column
:issues
,
:relative_position
,
:
float
add_column
:issues
,
:relative_position
,
:
integer
add_index
:issues
,
:relative_position
add_index
:issues
,
:relative_position
end
end
...
...
db/schema.rb
View file @
34bf798e
...
@@ -515,7 +515,7 @@ ActiveRecord::Schema.define(version: 20170216141440) do
...
@@ -515,7 +515,7 @@ ActiveRecord::Schema.define(version: 20170216141440) do
t
.
text
"title_html"
t
.
text
"title_html"
t
.
text
"description_html"
t
.
text
"description_html"
t
.
integer
"time_estimate"
t
.
integer
"time_estimate"
t
.
float
"relative_position"
t
.
integer
"relative_position"
end
end
add_index
"issues"
,
[
"assignee_id"
],
name:
"index_issues_on_assignee_id"
,
using: :btree
add_index
"issues"
,
[
"assignee_id"
],
name:
"index_issues_on_assignee_id"
,
using: :btree
...
...
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