Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
front: simplify OP matching in updatePathStepsFromOperationalPoints()
We already have a matchPathStepAndOp() function to compare a PathStep and a SuggestedOP. There are two differences: - The old code checks whether PathStep.ch is set before comparing it with SuggestedOP, but that's incorrect. On the editoast side the secondary_code field is defined as Option<String>: None accepts OPs with any secondary code, "" accepts only OPs without any secondary code. On the TypeScript side, undefined accepts OPs with any secondary code, and '' accepts only OPs without any secondary code. However `'ch' in step` is true for `{ ch: undefined }`, which compares SuggestedOP.ch with undefined even if an undefined PathStep.ch is supposed to match any OP secondary code. - The old code checks PathStep.secondary_code. However the PathSteps given to updatePathStepsFromOperationalPoints() come straight up from computeBasePathSteps(), which always leaves secondary_code undefined. As a result we never hit this case. Signed-off-by: Simon Ser <[email protected]>
- Loading branch information