You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-08-14] [$250] Distance - Distance still shows Pending when preview and report header already show distance #43569
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: 1.4.82-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/4620914 Issue reported by: Applause - Internal Team
Action Performed:
Go to staging.new.expensify.com
Go to workspace chat
Submit a distance expense
Go to expense report while the receipt is being generated
Note that the distance is already computed in the expense preview
Go to transaction thread while the receipt is being generated
Note that the distance in transaction thread header is also computed
Note that the Distance row still shows "Pending" while it is computed in Step 6 and 7
Expected Result:
The Distance row in transaction thread should display the distance when the distance is computed
Actual Result:
The Distance row in transaction thread displays "Pending" when the expense preview and transaction thread header already display the distance
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
@trjExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
It's to address this comment where the distance value still shows the old value after update, so Pending... is shown while waiting for the updated distance value.
What changes do you think we should make in order to solve the problem?
In main, when we change the waypoints, the distance value is already updated from GetRoute request, so I don't think we need to show Pending... anymore by always showing the distanceToDisplay here.
The reason we try to convert it from miles to meters is because after the transaction is created (RequestMoney)/waypoints is updated (UpdateMoneyRequestDistance), the distance value is in miles instead of meters which is different from GetRoute response. I think this needs to be discussed first how to fix it. Maybe we can update GetRoute to returns the distance value based on the workspace unit (miles/km).
Based on the discussion, we want to get the distance from transaction.routes.route0.distance if it exist (which is in meters), otherwise, we get it from transaction.comment.customUnit.quantity (which is in saved unit). The first thing to do is to clear the routes object from the transaction when the create/update distance request is completed.
changed the title [-]Distance - Distance still shows Pending when preview and report header already show distance[/-][+][$250] Distance - Distance still shows Pending when preview and report header already show distance[/+]on Jun 13, 2024
However, I see another issue. The distance shown is in meters even though the unit is in miles.
Nice catch.
Maybe we can update GetRoute to return the distance value based on the workspace unit (miles/km).
I like this suggestion. However, it might create more issues if we are supposed to use a static unit in calculations. But I differ this to internal team who has better idea on this.
Other than this, @bernhardoj Did you check for the offline behaviour?
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon Jun 12, 2024
Triggered auto assignment to @trjExpensify (
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.lanitochka17 commentedon Jun 12, 2024
@trjExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
lanitochka17 commentedon Jun 12, 2024
We think that this bug might be related to #wave-collect - Release 1
bernhardoj commentedon Jun 12, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Distance value shows Pending... even though the distance is shown/calculated in the confirmation list and in the preview.
What is the root cause of that problem?
If there is a pending action of waypoints, it will show Pending...
App/src/components/ReportActionItem/MoneyRequestView.tsx
Line 283 in 8563b9f
When we create a new request, an ADD pending action is set, that's why the Pending... is shown.
App/src/libs/actions/IOU.ts
Line 1963 in 8563b9f
It's to address this comment where the distance value still shows the old value after update, so Pending... is shown while waiting for the updated distance value.
What changes do you think we should make in order to solve the problem?
In
main, when we change the waypoints, the distance value is already updated from GetRoute request, so I don't think we need to show Pending... anymore by always showing thedistanceToDisplayhere.App/src/components/ReportActionItem/MoneyRequestView.tsx
Line 283 in 8563b9f
(or update the condition to specifically check for update pending action)
However, I see another issue. The distance shown is in meters even though the unit is in miles.
Screen.Recording.2024-06-13.at.00.20.01.mov
It's because, GetRoute API returns the distance in meters, but we try to convert it from miles to meters here,
App/src/components/ReportActionItem/MoneyRequestView.tsx
Line 190 in 8563b9f
The reason we try to convert it from miles to meters is because after the transaction is created (RequestMoney)/waypoints is updated (UpdateMoneyRequestDistance), the distance value is in miles instead of meters which is different from GetRoute response.
I think this needs to be discussed first how to fix it. Maybe we can update GetRoute to returns the distance value based on the workspace unit (miles/km).Based on the discussion, we want to get the distance from
transaction.routes.route0.distanceif it exist (which is in meters), otherwise, we get it fromtransaction.comment.customUnit.quantity(which is in saved unit). The first thing to do is to clear theroutesobject from the transaction when the create/update distance request is completed.App/src/libs/actions/IOU.ts
Lines 689 to 696 in 7c37886
App/src/libs/actions/IOU.ts
Lines 2707 to 2715 in 7c37886
Next, we create a new
TransactionUtilsfunction calledgetDistanceInMeterswhich contains the logic above.Then, replace all
TransactionUtils.getDistanceusage withTransactionUtils.getDistanceInMeters.For MoneyRequestView, we want to replace the whole line with
TransactionUtils.getDistanceInMeters.App/src/components/ReportActionItem/MoneyRequestView.tsx
Line 210 in 7c37886
trjExpensify commentedon Jun 13, 2024
Hm, I think this was a vip-vsb initiative originally. @paultsimura and @neil-marcellini I recall have the subject matter knowledge on this one.
[-]Distance - Distance still shows Pending when preview and report header already show distance[/-][+][$250] Distance - Distance still shows Pending when preview and report header already show distance[/+]melvin-bot commentedon Jun 13, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01531942e35c6e84c9
melvin-bot commentedon Jun 13, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (
External)parasharrajat commentedon Jun 17, 2024
Nice catch.
I like this suggestion. However, it might create more issues if we are supposed to use a static unit in calculations. But I differ this to internal team who has better idea on this.
Other than this, @bernhardoj Did you check for the offline behaviour?
78 remaining items
trjExpensify commentedon Aug 15, 2024
Thanks! @neil-marcellini will regression tests for the P2P Distance project be added centrally when the project is wrapped?
trjExpensify commentedon Aug 15, 2024
Payment summary as follows:
Feel free to go ahead and submit on ND!
bernhardoj commentedon Aug 15, 2024
Requested in ND.
melvin-bot commentedon Aug 20, 2024
@trjExpensify, @parasharrajat, @neil-marcellini, @bernhardoj Huh... This is 4 days overdue. Who can take care of this?
JmillsExpensify commentedon Aug 21, 2024
$250 approved for @bernhardoj
melvin-bot commentedon Aug 22, 2024
@trjExpensify, @parasharrajat, @neil-marcellini, @bernhardoj 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
trjExpensify commentedon Aug 23, 2024
I'm back, reached out to @neil-marcellini on this Q before closing this out.
neil-marcellini commentedon Aug 23, 2024
Yes
trjExpensify commentedon Aug 23, 2024
Great, closing!
parasharrajat commentedon Aug 30, 2024
Payment requested as per #43569 (comment)
JmillsExpensify commentedon Sep 2, 2024
$250 approved for @parasharrajat