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

MissingCoordinates: 0 is valid for latitude or longitude #201

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

AntoineAugusti
Copy link
Member

@AntoineAugusti AntoineAugusti commented Sep 4, 2024

MissingCoordinates was a bit too strict, and 0 was rejected for a stop latitude or longitude.

We now allow a 0 as the latitude XOR (EXCLUSIVE OR) longitude field.

Logged #202 to add further checks for stop coordinates.

@AntoineAugusti AntoineAugusti marked this pull request as ready for review September 4, 2024 07:37
@AntoineAugusti AntoineAugusti enabled auto-merge (squash) September 4, 2024 07:38
Copy link
Contributor

@thbar thbar left a comment

Choose a reason for hiding this comment

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

The fix looks good to me!

I would tweak the tests if possible to explicitly allow "0 on one coordinate only".

Also, I would recommend tweaking the PR documentation:

We now allow a 0 as the latitude OR longitude field.

replaced by:

We now allow a 0 as the latitude "XOR (EXCLUSIVE OR)" longitude field.

@@ -133,7 +131,7 @@ fn test_missing() {
.collect();

assert_eq!(1, missing_coord_issue.len());
assert_eq!("AMV", missing_coord_issue[0].object_id);
assert_eq!("null_island", missing_coord_issue[0].object_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ love null island !

I would probably add a test explicitly allowing DIJON/AMV and verifying that they have one zero and not two in their coordinates.

If that is a bit too complicated to write, just a comment on ligne above, since this is also indirectly tested by the fact that missing_cord_issue.len() == 1 at the moment (but this is less explicit, and would not protect us from a regression if someone else removes AMV/DIJON from the test set in the future, unknowingly.

@AntoineAugusti AntoineAugusti merged commit e3cd571 into master Sep 4, 2024
2 checks passed
@AntoineAugusti AntoineAugusti deleted the stop_coordinates_valid_zero branch September 4, 2024 08:26
@thbar
Copy link
Contributor

thbar commented Sep 4, 2024

And... I missed the auto-merge part 😄 Not a problem for production though.

@AntoineAugusti
Copy link
Member Author

I updated the PR description to reflect the XOR.

I considered writing assertions proving that we have a stop with 0 latitude and another one with a 0 longitude but I'm not proficient enough at writing Rust so this will be for another time or another contributor!

@thbar
Copy link
Contributor

thbar commented Sep 4, 2024

I updated the PR description to reflect the XOR.

Thanks!

I considered writing assertions proving that we have a stop with 0 latitude and another one with a 0 longitude but I'm not proficient enough at writing Rust so this will be for another time or another contributor!

Gotcha 👍

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.

2 participants