chairemobilite / transition

Transition is a modern new approach to transit planning. It's a web application to model, simulate and plan public transit and alternative transportation.
http://transition.city
MIT License
20 stars 13 forks source link

Node: A new node that has not changed since its creation is considered has not changed and cannot be saved #857

Closed kaligrafy closed 3 months ago

kaligrafy commented 4 months ago

Server logs: An error occurred while getting nodes associated path ids: Cannot get nodes associated path ids from tables tr_transit_nodes and tr_transit_paths (error: The number of nodes received do not match the number of nodes sent in the query (DBQNGAP0003)) (DBQNGAP0004)

Now it is impossible to save a new node, even after running refresh transferable nodes. In fact, if you create a new node with a name, it works, but any new node without name, it will just silently ignore the save

tahini commented 3 months ago

The error you mentioned is not related, I'll open an issue for it. But saving a node without a name should not be allowed. Or should it? Now, it is possible to save a node without name or code

kaligrafy commented 3 months ago

We need to think about this, should we allow nodes with no name? It could be useful in auto-generated nodes or just for testing purposes...

tahini commented 3 months ago

Turns out about the name, there is a preference transit.nodes.nameIsRequired to force require... anyhow, we still have to decide if we want the code to be mandatory.

As for the current issue, the problem of not saving is because the node has not changed since its creation and cannot be saved! If the object is new, it should be possible to consider it as changed, even if there is no history on the object. The validate method of objects will ensure that the object's initial default values are ok to be saved. In the case of a node, it is created with its precise geography, so a new node is valid.

kaligrafy commented 3 months ago

Nice catch!