stefankroes / ancestry

Organise ActiveRecord model into a tree structure
MIT License
3.72k stars 458 forks source link

Partial tree sort tests #613

Closed kbrock closed 1 year ago

kbrock commented 1 year ago

extracted from https://github.com/stefankroes/ancestry/pull/415

add documentation to tests.

Unsure if we can assume that nodes passed into sort_by_ancestry are in a sane order.

kbrock commented 1 year ago

update:

I had thought that pagination would ensure that you don't end up with cousins and not at least one aunt/uncle. It looks like even when using order_by_ancestry_and(:rank) that you can definitely get cousins without any parents.

Dropped that set of test changes.

example for reference:

order(ancestry,id): 1, 2, 3, 4, 5, 6, 8, 7

since 6,8 are so far from 1,2, pagination can definitely throw them seperate.