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

[feature] Check coherence of Geometries in the model and fix it #543

Merged
merged 2 commits into from
Mar 5, 2020

Conversation

woshilapin
Copy link
Contributor

No description provided.

@woshilapin woshilapin changed the title [feature] Check coherence of Geomtries in the model and fix it [feature] Check coherence of Geometries in the model and fix it Feb 12, 2020
"category": "ObjectNotFound",
"message": "object_type=route, object_id=RERAF: geometry unknown not found"
"category": "OldPropertyValueDoesNotMatch",
"message": "object_type=route, object_id=RERAF, property_name=route_geometry: property_old_value does not match the value found in the data"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is now dead code. https://github.com/CanalTP/transit_model/blob/master/src/apply_rules/property_rule.rs#L397

you may remove the code and add a comment that explains why this case should never happen now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is dead code. The geo_id is given by an end-user when configuring an apply-rules process. So it is still possible to end up in this code with an incorrect ID I believe.

Copy link
Member

@datanel datanel Feb 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case in the link above means
an object has a geometry_id and there is no geometries in the collection of geometries with id = geometry_id
but this case never happen now with your change.

If I'm wrong you should write the test for this case

and geo_id is not given by end-user but is the geometry_id of an object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a unit test for testing this case.

In term of public API, we indeed accept a Model so the case you're mentioning should never happen. But there is also internal API, like crate::apply_rules::property_rules::update_geometry(), or crate::apply_rules::property_rules::apply_rules() (which accept a Collections, not a Model) that a future developer might use at some point.

@woshilapin woshilapin force-pushed the geometries-check branch 3 times, most recently from a27a334 to c578cfe Compare February 28, 2020 13:09
@ArnaudOggy ArnaudOggy added the wip label Mar 2, 2020
@ArnaudOggy ArnaudOggy removed the wip label Mar 5, 2020
@ArnaudOggy
Copy link
Contributor

@Mergifyio refresh

@mergify
Copy link
Contributor

mergify bot commented Mar 5, 2020

Command refresh: success

@ArnaudOggy ArnaudOggy merged commit 65e45ab into hove-io:master Mar 5, 2020
@woshilapin woshilapin deleted the geometries-check branch March 5, 2020 11:06
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

Successfully merging this pull request may close these issues.

3 participants