Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[bug] position field broken with children elements #57

Closed
signebedi opened this issue Jun 4, 2023 · 0 comments
Closed

[bug] position field broken with children elements #57

signebedi opened this issue Jun 4, 2023 · 0 comments

Comments

@signebedi
Copy link
Owner

signebedi commented Jun 4, 2023

[bug] position field broken with children elements
Currently, when we create children, it still uses the standard position of the document based on the length of the total database.

    def create(self, data, parent_id=None):
        data['created_at'] = datetime.datetime.now()
        data['last_edited'] = datetime.datetime.now()
        data['position'] = self.collection.count_documents({}) + 1  # Assign the next position
        if parent_id is not None:
            data['parent_id'] = parent_id  # Add the parent_id to the document
        return self.collection.insert_one(data).inserted_id

We need to change this such that, if parent is not null, we use different logic to determine position.

Originally posted by @signebedi in #9 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant