Skip to content

Adding the same node object as a child to multiple topics results in multiple nodes with the same node_id #354

Open
@rtibbles

Description

@rtibbles
  • ricecooker version: 0.7.0b2
  • Python version: Python 3.9
  • Operating System: Ubuntu Linux

Observed Behaviour

If attempting to repeat a node in multiple places in a topic tree, it seems natural to be able to add it as the child of multiple TopicNodes. Indeed, ricecooker allows you to do this, and even makes the topic tree in this format appear on Studio.

However, because the nodes objects are shared between the two locations, the node_id is recalculated for the last occurring location, but all occurrences of the node then share that node_id.

This means that the topic tree appears to be properly formatted on Studio, where each node has a distinct primary key, but once published to Kolibri where the node_id is the primary key, the node will only appear in the last location in the tree, as that will be the last one written to the SQLite database during publishing.

Expected Behaviour

If this is allowed, then ricecooker should internally clone nodes that are added in multiple locations in the tree.

Otherwise, it should give an error when this happens and exit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions