Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix when order column is not named 'sort_order' #106

Merged
merged 1 commit into from
Jun 20, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/closure_tree/numeric_deterministic_ordering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ def add_sibling(sibling, add_after = true)
_ct_reorder_siblings(reorder_from_value)

# The sort order should be correct now except for self and sibling, which may need to flip:
sibling_is_after = self.reload.sort_order < sibling.reload.sort_order
sibling_is_after = self.reload.order_value < sibling.reload.order_value
if add_after != sibling_is_after
# We need to flip the sort orders:
self_so, sib_so = self.sort_order, sibling.sort_order
update_order_value(sib_so)
sibling.update_order_value(self_so)
self_ov, sib_ov = self.order_value, sibling.order_value
update_order_value(sib_ov)
sibling.update_order_value(self_ov)
end

if prior_sibling_parent != self.parent
Expand Down