提交 34bf798e 编写于 作者: V Valery Sizov

[Issue ordering] Using integer instead of float

上级 69e0b06d
module RelativePositioning
extend ActiveSupport::Concern
MIN_POSITION = Float::MIN
MAX_POSITION = Float::MAX
MIN_POSITION = 0
MAX_POSITION = Gitlab::Database::MAX_INT_VALUE
included do
after_save :save_positionable_neighbours
......@@ -120,7 +120,7 @@ module RelativePositioning
def position_between(pos_before, pos_after)
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
def save_positionable_neighbours
......
......@@ -24,7 +24,7 @@ class AddRelativePositionToIssues < ActiveRecord::Migration
# disable_ddl_transaction!
def change
add_column :issues, :relative_position, :float
add_column :issues, :relative_position, :integer
add_index :issues, :relative_position
end
......
......@@ -515,7 +515,7 @@ ActiveRecord::Schema.define(version: 20170216141440) do
t.text "title_html"
t.text "description_html"
t.integer "time_estimate"
t.float "relative_position"
t.integer "relative_position"
end
add_index "issues", ["assignee_id"], name: "index_issues_on_assignee_id", using: :btree
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册