Skip to content

Deleting and appending to a subtree #51

@clapas

Description

@clapas

There seems to be a problem with tree updating.

Let's suppose I have a simple 2 level tree created using the model methods create() and append(), i.e. only a root node and a couple children. The tree is correct in the begining.

Now, if I replace the whole 2nd level, i.e. everything under my root node, and append new nodes to the root node, the _lft and _rgt numbers for the first appended child outbound the parents'. Despite the children() method returning all the children nodes (because the parent_id property links them correctly), a call to descendantsOf(), which traverses the tree using the _lft and _rgt numbers, leave the first child out.

The procedure I used to replace the 2nd level is by calling delete() on every child to be removed and then calling append() on the root node for each new child. It is always the first newly appended child which is left out because the _lft and _rgt numbers on the parent don't include this child's ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions