BigW Consortium Gitlab

Commit 69e0b06d by Valery Sizov

[Issue Sorting] Add project scope when calculate maximum position[ci skip]

parent 1ff3cd99
......@@ -9,11 +9,11 @@ module RelativePositioning
end
def min_relative_position
self.class.minimum(:relative_position)
self.class.in_projects(project.id).minimum(:relative_position)
end
def max_relative_position
self.class.maximum(:relative_position)
self.class.in_projects(project.id).maximum(:relative_position)
end
def prev_relative_position
......@@ -21,6 +21,7 @@ module RelativePositioning
if self.relative_position
prev_pos = self.class.
in_projects(project.id).
where('relative_position < ?', self.relative_position).
maximum(:relative_position)
end
......@@ -33,6 +34,7 @@ module RelativePositioning
if self.relative_position
next_pos = self.class.
in_projects(project.id).
where('relative_position > ?', self.relative_position).
minimum(:relative_position)
end
......
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