Commit 34bf798e authored by Valery Sizov's avatar Valery Sizov

[Issue ordering] Using integer instead of float

parent 69e0b06d
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
......
...@@ -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
......
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment