Improve order edit page in data inconsistency scenario (follow up from S2 #4186) #5350
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.
What? Why?
This is a follow up from #5253 that improves the situation for #4186
This is handling a data inconsistency problem that is not critical therefore I am not writing specs for this. The next step is to investigate the root cause, but that's an S3 now so we leave it for later.
In this PR I am simply fixing my code in #5253, break is aborting the cycle through units, if one unit is broken (no line item found) we can still iterate through the other units so that the user sees the remaining items in the order instead of a empty order.
See Filipe's testing comments in #5253 for more details.
What should we test?
Have a look at the order from #5253
https://staging.openfoodfrance.org/admin/orders/R656741034/edit
No line items before this PR, one line item after this PR.
And/or repeat tests of #5253 and make sure the remaining line item (not the broken one) is now displayed.
Release notes
Changelog Category: Changed
Improved the handling of a data inconsistent scenario in the orders edit page.