Repository navigation
Resolve duplicated port codes and reject port-list namesakes - #25
Merged
Merged
Conversation
Twelve codes have two port-list records and no UN/LOCODE position, so resolution called the throwing GetByCode overload and every movement through them failed, Nhava Sheva (INNSA) included. Port-to-port routes threw for all 38 duplicated codes. Resolution now takes the record nearest the UN/LOCODE position or, without one, the terminal record of a group lying within 50 km, and throws only for records further apart. When UN/LOCODE lists a code without a position, the port-list record was used even when it named a different place: Latrobe (USLBE) resolved to Laguna Beach, California. The names must now agree, allowing for spelling variants such as Haerbin and Harbin. 27 codes now throw an ArgumentException naming both places.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GetByCodeoverload, so every movement andLocatethrough them failed, whatever the mode. Port-to-portCalculateRoutethrew for all 38 duplicated codes, CAVAN included. A newSelectPortRecordtakes the record nearest the UN/LOCODE position or, without one, the terminal record of a group lying within 50 km. It throws only when the records are further apart.Locate("USLBE")returned Laguna Beach, California, not Latrobe, Pennsylvania. The names must now agree, allowing for spelling variants such as Haerbin and Harbin, and Helsinki and Helsingfors. 27 codes now throw anArgumentExceptionnaming both places, 21 of them in the United States.Behaviour changes to note
Testing
dotnet test -m:1 -nr:false: 580 passed on net8.0 and net10.0.