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