-
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
[$500] Distance - Same location is allowed when it is entered in "Stop" #28477
Comments
ProposalPlease re-state the problem that we are trying to solve in this issue.The Next button should disabled when adding the same stop and finish point without adding a different start point. What is the root cause of that problem?We are using App/src/components/DistanceRequest.js Line 112 in 38030f8
App/src/components/DistanceRequest.js Line 300 in 38030f8
In the App/src/libs/TransactionUtils.js Lines 382 to 405 in 38030f8
When we leave start blank and have stop and finish the same. Then through iterations in reduce we have:
So it results in the same finish and stop being added to the valid waypoint. What changes do you think we should make in order to solve the problem?We should update logic to get correct let previousWaypoint = null; Remove this line App/src/libs/TransactionUtils.js Line 416 in dfb3f9b
And assign new previousWaypoint
.....
previousWaypoint = currentWaypoint;
const validatedWaypoints = {...acc, [`waypoint${reArrangeIndexes ? lastWaypointIndex + 1 : index}`]: currentWaypoint}; What alternative solutions did you explore? (Optional)N/A |
Job added to Upwork: https://www.upwork.com/jobs/~01642f7f93e05ba24c |
Triggered auto assignment to @abekkala ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @0xmiroslav ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Next Button Activated with Same Stop and Finish Point in Request Money What is the root cause of that problem?In App/src/components/DistanceRequest.js Line 300 in 71db96d
Now to generate validatedWaypoints the code is in file src/libs/TransactionUtils.js App/src/libs/TransactionUtils.js Lines 357 to 390 in 71db96d
This function fails in a edge case where starting waypoints are invalid because here lastWaypointIndex is equal to -1 in starting which suggests that first waypoint will always be valid when waypoints size > 1 . What changes do you think we should make in order to solve the problem?We have to have increment lastWaypointIndex till we find some valid waypoint and then it is good to go . Here is my solution
Here I have introduced a new variable named as foundFirstValidWaypoint which is false in starting and once we find a validwaypoint we will set it to true till the time we will increment lastWaypointIndex in each iteration . What alternative solutions did you explore? (Optional)NA |
ProposalPlease re-state the problem that we are trying to solve in this issue.Adding the same location on stops is allowed if the values are entered in 'Stop' values not in Start and Finish What is the root cause of that problem?The calculation of In the scenario: Start: empty where What changes do you think we should make in order to solve the problem?We can simply change this line to
By this, when evaluating a waypoint, we always compare its address with the last valid waypoint before, which is the original intention. What alternative solutions did you explore? (Optional)We're currently allowing duplicate waypoints when creating a money request, as long as there're at least 2 valid waypoints. We can be stricter here by only allow the user to continue the flow if there's no duplicate waypoint in the waypoints list. If there's any duplicate adjacent waypoint, we can still draw the stops in the map, but the user must fix the duplicate waypoint before continuing. |
@abekkala I reported first here :https://expensify.slack.com/archives/C049HHMV9SM/p1695412007448899?thread_ts=1695412007.448899&cid=C049HHMV9SM could change my name , Thank you |
ProposalPlease re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?Let's see the logic to validate waypoints App/src/libs/TransactionUtils.ts Lines 424 to 444 in 732d48e
The logic to update lastWaypointIndex in the end of function App/src/libs/TransactionUtils.ts Line 441 in 732d48e
Then if the condition here is true App/src/libs/TransactionUtils.ts Line 430 in 732d48e
lastWaypointIndex will be not updated. It causes this bug What changes do you think we should make in order to solve the problem?I suggest we should remove lastWaypointIndex and use index-1 instead we also can move this line App/src/libs/TransactionUtils.ts Line 441 in 732d48e
before the condition App/src/libs/TransactionUtils.ts Line 430 in 732d48e
What alternative solutions did you explore? (Optional)
|
@0xmiroslav can you please review the proposals that have come in? thanks! |
We have this issue #27045 already which is going to handle this case so I'm going to close it. |
@neil-marcellini The above issue persists even after merging #27045. Can you please reopen this issue? |
@neil-marcellini @0xmiroslav @abekkala this issue is still reproducible, can you reopen it |
#29895 is a dupe and we should reopen this one as it's older. |
@jo-ui are you still able to reproduce this? |
@0xmiroslav Yes it is still reproducible |
@abekkala gentle bump on #28477 (comment), thanks! |
ProposalPlease re-state the problem that we are trying to solve in this issue.This proposal is brought from 29895 here. We are able to create two consecutive duplicate waypoints when there are What is the root cause of that problem?Currently, the logic supports consecutive duplicate waypoints when there are no What changes do you think we should make in order to solve the problem?In the logic of determining
|
@neil-marcellini can you please reopen this? You said #28477 (comment) but issue is still reproducible as #27045 didn't cover this. |
I think we should reopen the original issue here - #29895 (comment) @rojiphil and I spent time on it |
ProposalPlease re-state the problem that we are trying to solve in this issue.Users can go to the next page when entering two consecutive same endpoints What is the root cause of that problem?We don't have logic to prevent user from clicking next button when they enter two consecutive same endpoints What changes do you think we should make in order to solve the problem?Note that in App/src/components/DistanceRequest/index.js Line 180 in bf2d545
we should check if _.size(validatedWaypoints) < _.size(waypoints) we will prevent user from submitting
Also need to update here App/src/components/DistanceRequest/index.js Line 220 in bf2d545
In this function App/src/components/DistanceRequest/index.js Line 147 in bf2d545
we also add a message like "please remove duplicated waypoints" if _.size(validatedWaypoints) < _.size(waypoints)
We also prevent user going to next page by deeplink when they enter 2 consecutive same waypoints App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js Line 98 in bf2d545
In here we also need to add condition like we did in DistanceRequest Page ( _.size(validatedWaypoints) < _.size(waypoints) )
|
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
The same location should not be allowed in the "Stop" field
Actual Result:
Adding the same location on stops is allowed if the values are entered in 'Stop' values not in Start and Finish
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.74.2
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-28.18-04-03.mp4
2023-09-27.17-09-08.mp4
mweb_stp.MP4
IOS_stp.MP4
Android_stp.mp4
Screen_Recording_20230929_090656_Chrome.mp4
Expensify/Expensify Issue URL:
Issue reported by: @jo-ui
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695823418913709
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: