Skip to content
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-09-20] [HOLD for payment 2023-09-12] [$1000] Fix the logic to check Start and Finish waypoints #26583

Closed
6 tasks done
hayata-suenaga opened this issue Sep 2, 2023 · 47 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@hayata-suenaga
Copy link
Contributor

hayata-suenaga commented Sep 2, 2023

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:

  1. Go to a workspace chat
  2. Click on the "+" icon next to the text composer
  3. Select "Request money" and then choose "Distance"
  4. Select the starting and finishing points
  5. Click on "Add stop". Don't save an address for this new waypoint/stop.
  6. Proceed by clicking the "Next" button.
  7. Check that a route line is not drawn on the map on the confirmation page when it should. Click "Save" on the next screen
  8. Check the error message that appears on the request preview.

Expected Result:

Describe what you think should've happened

Actual Result:

Describe what actually happened

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.3.62-1
Reproducible in staging?: Yes
Reproducible in production?: No (feature is not available on staging yet)
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
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693689189765409

screen-recording-2023-09-03-at-20137-am_pNn1szAr.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fd9ea344375ece26
  • Upwork Job ID: 1698087422245027840
  • Last Price Increase: 2023-09-02
  • Automatic offers:
    • ntdiary | Reviewer | 26471457
    • situchan | Contributor | 26483019
@hayata-suenaga hayata-suenaga added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 2, 2023
@hayata-suenaga hayata-suenaga self-assigned this Sep 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

Triggered auto assignment to @JmillsExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot changed the title Correct the logic to check Start and Finish waypoints [$500] Correct the logic to check Start and Finish waypoints Sep 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01fd9ea344375ece26

@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

Triggered auto assignment to @kadiealexander (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @ntdiary (External)

@hayata-suenaga hayata-suenaga changed the title [$500] Correct the logic to check Start and Finish waypoints [$1000] Correct the logic to check Start and Finish waypoints Sep 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

Upwork job price has been updated to $1000

@hayata-suenaga
Copy link
Contributor Author

Double the price because this is a regression from Wave 5 project that needs an urgent fix

@hayata-suenaga hayata-suenaga changed the title [$1000] Correct the logic to check Start and Finish waypoints [$1000] Fix the logic to check Start and Finish waypoints Sep 2, 2023
@allroundexperts
Copy link
Contributor

allroundexperts commented Sep 2, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Logic to check Start and Finish waypoints is broken.

What is the root cause of that problem?

We're returning false if any of the way point is not valid (or is empty) here.

What changes do you think we should make in order to solve the problem?

First, we need to make sure that we're invalidating all the waypoints only if the number of valid waypoints are less than 2.
This can be done by replacing this code with:

const validWaypoints = _.reduce(waypointValues, (acc, currentWaypoint, index) => {
        const previousWaypoint = waypointValues[index - 1];
        // Check if the waypoint has a valid address
        if (!currentWaypoint || !currentWaypoint.address || typeof currentWaypoint.address !== 'string' || currentWaypoint.address.trim() === '') {
            return acc;
        }

        // Check for adjacent waypoints with the same address
        if (previousWaypoint && currentWaypoint.address === previousWaypoint.address) {
            return acc;
        }
        return {...acc, [`waypoint${index}`]: currentWaypoint};
    }, {});

    return validWaypoints;

Then inside the DistanceRequest component, we should replace this with:

    const validatedWaypoints = TransactionUtils.validateWaypoints(waypoints);
    const shouldFetchRoute = (!doesRouteExist || haveWaypointsChanged) && !isLoadingRoute && _.keys(validatedWaypoints).length > 1;

After this, we need to replace the Transaction.getRoute(iou.transactionID, waypoints); call inside the useEffect hook to use validatedWaypoints instead and update the dependency of the effect as well from waypoints to validatedWaypoints.

Similarly, in the createDistanceRequest function inside the IOU.js file, we need to replace transaction.comment.waypoints with TransactionUtils.validateWaypoints(transaction.comment.waypoints).

Lastly, we should disable the continue button if validatedWaypoints < 2.

What alternative solutions did you explore? (Optional)

None

@samh-nl
Copy link
Contributor

samh-nl commented Sep 2, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Fix the logic to check Start and Finish waypoints

What is the root cause of that problem?

We are disabling the Next button with this logic in DistanceRequest:

isDisabled={waypointMarkers.length < 2}

However, we should also disable the button if the waypoints are invalid, as determined by TransactionUtils.validateWaypoints(waypoints).

What changes do you think we should make in order to solve the problem?

Disable the button if TransactionUtils.validateWaypoints(waypoints) returns false.

We can consider also disabling based on hasRouteError & isLoadingRoute to ensure validity before the user can proceed.

What alternative solutions did you explore? (Optional)

N/A

@Pujan92
Copy link
Contributor

Pujan92 commented Sep 2, 2023

@hayata-suenaga what is the expected result here?

@hayata-suenaga
Copy link
Contributor Author

I'm checking with the exact requirement with the internal team right now. I'll get back to you soon after a quick discussion.

@JmillsExpensify
Copy link

JmillsExpensify commented Sep 2, 2023

For this case of someone entering two waypoints, and no further valid waypoints, we want to:

  • Allow user to tap Next only on Start and Stop have waypoints and all other subsequent waypoints are invalid
  • On tapping Next, discard all subsequent invalid waypoints, so there is just a start and finish (for this case of only entering two waypoints)

The same logic would also apply to the case where someone has entered three waypoints, with invalid waypoints mixed in. So for instance, valid Start and Stop, with an invalid additional Stop but a valid Finish. If the user taps next then we'll save the valid Start, Stop, and Finish and discard the one invalid Stop.

This approach optimizes for not requiring extra steps of the user even if they accidentally "fat finger" an extra stop. Any questions, please let us know.

@allroundexperts
Copy link
Contributor

I think my proposal is doing just that. @hayata-suenaga Can I get some feedback on it?

@hayata-suenaga
Copy link
Contributor Author

yes I think yours accomplish the requirements @allroundexperts let's do this 🚀

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

📣 @ntdiary 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

📣 @allroundexperts Please request via NewDot manual requests for the Contributor role ($1000)

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.63-2 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-09-12. 🎊

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.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

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:

@melvin-bot melvin-bot bot added Daily KSv2 Weekly KSv2 and removed Weekly KSv2 Daily KSv2 labels Sep 12, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-09-12] [$1000] Fix the logic to check Start and Finish waypoints [HOLD for payment 2023-09-20] [HOLD for payment 2023-09-12] [$1000] Fix the logic to check Start and Finish waypoints Sep 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.68-17 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-09-20. 🎊

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.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

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:

@melvin-bot melvin-bot bot added the Overdue label Sep 21, 2023
@hayata-suenaga
Copy link
Contributor Author

@ntdiary / @allroundexperts / @situchan could any of you complete the bug zero checklist please 🙇

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2023
@ntdiary
Copy link
Contributor

ntdiary commented Sep 25, 2023

  • [@ntdiary / @allroundexperts / @situchan] The PR that introduced the bug has been identified. Link to the PR: N/A
  • [@ntdiary / @allroundexperts / @situchan] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: N/A
  • [@ntdiary / @allroundexperts / @situchan] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: No need
  • [@ntdiary / @allroundexperts / @situchan] Determine if we should create a regression test for this bug. No need
  • [@ntdiary / @allroundexperts / @situchan] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again. No need
  • [@JmillsExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

Personally, I feel this issue occurred during the Distance request feature polishing stage, and then we clarified how to optimize the interaction in this GH thread. So there wasn't a strong opinion to create regression tests for it, however, if others feel it is necessary, I am also happy to follow. 🙂

@hayata-suenaga
Copy link
Contributor Author

I also feel like regression test is not necessary. I agree with @ntdiary

@melvin-bot melvin-bot bot added the Overdue label Oct 4, 2023
@ntdiary
Copy link
Contributor

ntdiary commented Oct 4, 2023

@JmillsExpensify

@situchan (C+) helped with the review along with @ntdiary (C+)

Hi, since @situchan helped complete most of the review work, I personally feel getting 20% of c+ amount is good enough for me, or giving all of it to @situchan is good too. : )

@melvin-bot melvin-bot bot removed the Overdue label Oct 4, 2023
@JmillsExpensify
Copy link

Alright thanks! Here's the payment summary then:

Is this agreeable with everyone?

@situchan

This comment was marked as resolved.

@JmillsExpensify
Copy link

@hayata-suenaga Can you confirm that you agree with this summary?

@hayata-suenaga
Copy link
Contributor Author

hayata-suenaga commented Oct 9, 2023

@JmillsExpensify yes I agree with @situchan that this is eligible for bonus

assignment 9/3
first PR open 9/3 merge 9/4
second PR open 9/5 merge 9/6

@JmillsExpensify
Copy link

Great thanks. Updated payment summary.

@JmillsExpensify
Copy link

$1,500 payment approved for @allroundexperts based on summary above.

@situchan
Copy link
Contributor

situchan commented Oct 9, 2023

I already have offer accepted - #26583 (comment)

@JmillsExpensify
Copy link

I'm not seeing any other outstanding offers/contracts, though send me a link if there are.

@JmillsExpensify
Copy link

Everyone has been paid out though, so closing this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants