-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[HOLD for payment 2023-10-02] [$500] [Distance] - Wrong error is shown for maximum distance limitation even after deleting way point #27538
Comments
Job added to Upwork: https://www.upwork.com/jobs/~01fb0d667643024cc9 |
Triggered auto assignment to @mallenexpensify ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to @kevinksullivan ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.[Distance request] - Wrong error is shown for maximum distance limitation even after deleting way point What is the root cause of that problem?There is no error handle for matched start and end point What changes do you think we should make in order to solve the problem?We need to handle error matched start and end point.
import uniqWith from "lodash/uniqWith";
function isStartAndFinishWaypointsIdentical(waypoints) {
// filter waypoints by remove the empty and invalid waypoints
const validWaypoints = _.filter(_.values(waypoints), (waypoint) => waypointHasValidAddress(waypoint));
const uniqueWaypoints = uniqWith(validWaypoints, (a, b) => _.isEqual(a, b));
// we can also use the below method to get the unique waypoints
// const uniqueWaypoints = _.uniq(validWaypoints, false, "address");
return validWaypoints.length > 1 && uniqueWaypoints.length === 1;
}
const hasIdenticalError = TransactionUtils.isStartAndFinishWaypointsIdentical(waypoints);
const hasError = hasIdenticalError || hasRouteError;
const errorMessage = hasIdenticalError ? ["errors.identicalError"] : ErrorUtils.getLatestErrorField(transaction, 'route');
{(hasError) && (
<DotIndicatorMessage
style={[styles.mh5, styles.mv3]}
messages={errorMessage}
type="error"
/>
)} What alternative solutions did you explore? (Optional)N/A |
ProposalPlease re-state the problem that we are trying to solve in this issue.Wrong error is shown for maximum distance limitation even after deleting way point What is the root cause of that problem?We only fetch the route if there are > 1 validated waypoints, which would cause the error to reset and update. App/src/components/DistanceRequest.js Line 115 in 1862aff
Therefore, when you delete a waypoint which causes the new situation to not satisfy that condition (validated waypoints <= 1), it is not removed. What changes do you think we should make in order to solve the problem?We should clear App/src/libs/actions/Transaction.js Lines 83 to 86 in 1862aff
What alternative solutions did you explore? (Optional)In |
ProposalPlease re-state the problem that we are trying to solve in this issue.Wrong error is shown for maximum distance limitation even after deleting way point What is the root cause of that problem?I agree with Sam about the RCA. const shouldFetchRoute = (!doesRouteExist || haveWaypointsChanged) && !isLoadingRoute && _.size(validatedWaypoints) > 1; We're only receiving the error from backend, so in this case, the What changes do you think we should make in order to solve the problem?Because we only validate the waypoint through backend, we can clear the error while deleting a waypoint, after user choose another route or the // Doing a deep clone of the transaction to avoid mutating the original object and running into a cache issue when using Onyx.set
const newTransaction = {
...transaction,
comment: {
...transaction.comment,
waypoints: reIndexedWaypoints,
},
// Clear the existing route so that we don't show an old route
routes: {
route0: {
geometry: {
coordinates: null,
},
},
},
errorFields: {
route: null,
},
}; What alternative solutions did you explore? (Optional)N/A |
Note to all proposals:
We expect your own understanding of the problem, not the title to be reposted. Please think about this in future proposals. This could alone become a reason for rejection even if the solution is correct. Root cause and problem understanding are as important as solution. |
Triggered auto assignment to @Li357, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@parasharrajat Ok thanks for pointing out. So there's no misunderstanding, because I see @hungvu193 has the same approach. I last updated at 5.23 PM (GMT+2), and 3 mins later at 5.26 PM (GMT+2) @hungvu193 posted. |
Yeah, I posted proposal then reload the page then I saw you already updated yours. GG. I'll beat you next time 😂 |
I'm glad I pushed that Save button quickly 😎 |
I think the second option "change to something related" is a better user experience, we can handle new error "start and finish points are identical" I respect your decision, But I just want to understand. |
I expect the error to come from the backend same as it is being done for the maximum length reached. And I don't think we consider it wrong when the start and stop locations are the same. If that is the case we can think about that too. |
Awaiting @Li357 review. |
@Li357 I can take this over for you if you like. Lmk. |
Sorry about the delay here! This didn't show up in my K2 for some reason... @samh-nl's proposal looks good! |
@kevinksullivan , I removed your assignment, I was added via the
@Li357 , let me know if that happens again, K2 usually works well. |
🎯 ⚡️ Woah @parasharrajat / @samh-nl, great job pushing this forwards! ⚡️ The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉
On to the next one 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.73-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-10-02. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@Li357, @mallenexpensify, @parasharrajat, @samh-nl Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Issue reporter: @Nathan-Mulugeta paid $50 via Upwork @parasharrajat, please fill out the BZ checklist above |
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
Regression Test Steps
Do you agree 👍 or 👎 ? |
Payment requested as per #27538 (comment) |
$750 payment approved for @parasharrajat based on BZ summary above. |
@Li357, @mallenexpensify, @parasharrajat, @samh-nl Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
This is ready to be closed. |
TestRail GH created, thanks all! |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
The error should disappear or change to something related to the current issue at hand
Actual Result:
The error from the previous state persists and does not reset or disappear
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.70.5
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
2023-09-14.11.28.21.mp4
Recording.4494.mp4
Expensify/Expensify Issue URL:
Issue reported by: @Nathan-Mulugeta
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694680351264939
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: