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 2024-07-26] [$250] Distance - The map is centered on the user if it is not possible to create a route #44890

Closed
6 tasks done
izarutskaya opened this issue Jul 5, 2024 · 27 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Jul 5, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.0.4-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4695012
Email or phone of affected tester (no customers): sustinov@applausemail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

Prerequisites:
Create a Workspace on behalf of the administrator, invite an employee to it.

Steps:

  1. Open https://staging.new.expensify.com/.
  2. Log in with your employee account
  3. Navigate to the workspace room
  4. Tap on + Menu -> Submit expense -> Distance.
  5. Enter a start location in Hawaii
  6. Enter a finish location in San Diego
  7. Tap the "center-me" button

Expected Result:

When you click on the "center-me" button, the map should center on waypoints, even if there is no way to create a route

Actual Result:

When you click on the "centre-me" button, the map is centred on the user's location, if it is not possible to create a route

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6533176_1720103016442.Record_2024-07-04-19-03-54.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01caae7463e233bb94
  • Upwork Job ID: 1811060493662079823
  • Last Price Increase: 2024-07-10
  • Automatic offers:
    • c3024 | Reviewer | 103143669
Issue OwnerCurrent Issue Owner: @miljakljajic
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 5, 2024
Copy link

melvin-bot bot commented Jul 5, 2024

Triggered auto assignment to @miljakljajic (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@izarutskaya
Copy link
Author

We think this issue might be related to the #collect project.

@bernhardoj
Copy link
Contributor

Proposal

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

The map is centered on the user position instead of the waypoints if the route is impossible to create.

What is the root cause of that problem?

Currently, we only center on the waypoints if there is a directionCoordinates exists and there is at least 2.

const centerMap = useCallback(() => {
if (!mapRef) {
return;
}
if (directionCoordinates && directionCoordinates.length > 1) {
const {northEast, southWest} = utils.getBounds(waypoints?.map((waypoint) => waypoint.coordinate) ?? [], directionCoordinates);
const map = mapRef?.getMap();
map?.fitBounds([southWest, northEast], {padding: mapPadding, animate: true, duration: CONST.MAPBOX.ANIMATION_DURATION_ON_CENTER_ME});
return;
}
mapRef.flyTo({
center: [currentPosition?.longitude ?? 0, currentPosition?.latitude ?? 0],
zoom: CONST.MAPBOX.SINGLE_MARKER_ZOOM,
bearing: 0,
animate: true,
duration: CONST.MAPBOX.ANIMATION_DURATION_ON_CENTER_ME,
});
}, [directionCoordinates, currentPosition, mapRef, waypoints, mapPadding]);

It's coming from the transaction routes coordinates data which is retrieved from the GetRoute/Draft, but if it's impossible to create the route, then the data will be empty.

directionCoordinates={(transaction?.routes?.route0?.geometry?.coordinates as Array<[number, number]>) ?? []}

If it's empty, then we center on the current user position.

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

It's possible to center the waypoints with the coordinate from the selected waypoints itself, so, I propose to update the condition so it centers on the waypoints if the selected waypoints contain the coordinate.

const waypointCoordinates = waypoints?.map((waypoint) => waypoint.coordinate) ?? [];
if (waypointCoordinates.length > 1 || (directionCoordinates?.length ?? 0) > 1) {
    // center logic
}

@melvin-bot melvin-bot bot added the Overdue label Jul 8, 2024
Copy link

melvin-bot bot commented Jul 8, 2024

@miljakljajic Whoops! This issue is 2 days overdue. Let's get this updated quick!

@miljakljajic miljakljajic added the External Added to denote the issue can be worked on by a contributor label Jul 10, 2024
Copy link

melvin-bot bot commented Jul 10, 2024

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

@melvin-bot melvin-bot bot changed the title Distance - The map is centered on the user if it is not possible to create a route [$250] Distance - The map is centered on the user if it is not possible to create a route Jul 10, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 10, 2024
Copy link

melvin-bot bot commented Jul 10, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Jul 10, 2024
@c3024
Copy link
Contributor

c3024 commented Jul 10, 2024

@bernhardoj 's proposal here looks good to me!

🎀 👀 🎀 C+ Reviewed

Copy link

melvin-bot bot commented Jul 10, 2024

Triggered auto assignment to @MonilBhavsar, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Jul 15, 2024

@miljakljajic, @MonilBhavsar, @c3024 Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Jul 15, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 16, 2024
Copy link

melvin-bot bot commented Jul 16, 2024

📣 @c3024 🎉 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 melvin-bot bot removed the Overdue label Jul 16, 2024
@MonilBhavsar
Copy link
Contributor

Looks good!

@bernhardoj
Copy link
Contributor

PR is ready

cc: @c3024

Copy link

melvin-bot bot commented Jul 18, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 19, 2024
@melvin-bot melvin-bot bot changed the title [$250] Distance - The map is centered on the user if it is not possible to create a route [HOLD for payment 2024-07-26] [$250] Distance - The map is centered on the user if it is not possible to create a route Jul 19, 2024
Copy link

melvin-bot bot commented Jul 19, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 19, 2024
Copy link

melvin-bot bot commented Jul 19, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.9-5 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 2024-07-26. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jul 19, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR:
  • [@c3024] 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:
  • [@c3024] 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:
  • [@c3024] Determine if we should create a regression test for this bug.
  • [@c3024] 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.
  • [@miljakljajic] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@miljakljajic
Copy link
Contributor

Payment summary for @bernhardoj :

Owed 250 for their work reviewing this PR

@miljakljajic
Copy link
Contributor

@c3024 I have paid you in upwork. Do we need a regression test for this PR? Please complete the checklist above when you can

@bernhardoj
Copy link
Contributor

Requested in ND.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 26, 2024
@JmillsExpensify
Copy link

$250 approved for @bernhardoj

@melvin-bot melvin-bot bot added the Overdue label Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

@miljakljajic, @MonilBhavsar, @bernhardoj, @c3024 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@c3024
Copy link
Contributor

c3024 commented Jul 29, 2024

I'll complete the checklist in an hour.

@miljakljajic
Copy link
Contributor

@c3024 bump on this when you can today so we can get it closed out

@melvin-bot melvin-bot bot removed the Overdue label Jul 30, 2024
c3024 referenced this issue in bernhardoj/Expensify Jul 30, 2024
@c3024
Copy link
Contributor

c3024 commented Jul 30, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR: fix add center button and blue dot #40759
  • [@c3024] 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: bernhardoj@be55619#r144802233
  • [@c3024] 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 discussion was started because it does not appear that it could have been caught earlier.
  • [@c3024] Determine if we should create a regression test for this bug. Yes

@c3024
Copy link
Contributor

c3024 commented Jul 30, 2024

Regression Test Proposal

  1. Open FAB > Submit expense > Switch to Distance tab
  2. Select both waypoints that will result in an impossible route to create (e.g., San Diego and Hawaii)
  3. Move the map away from the waypoints
  4. Press the center map button
  5. Verify the map is centered between the selected waypoints

@c3024
Copy link
Contributor

c3024 commented Jul 30, 2024

Here are the regression test steps.

@miljakljajic
Copy link
Contributor

Thank you @c3024!

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

6 participants