Closed IuliiaHerets closed 2 weeks ago
Triggered auto assignment to @johncschuster (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.
@johncschuster 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
Edited by proposal-police: This proposal was edited at 2024-08-29 22:23:23 UTC.
Split distance - Split amount is not recalculated when entering 0 as input & editing distance
The condition remainingTotal < 0
is not correct in adjustRemainingSplitShares
, if the remaining amount is 0
it will update the amount for unmodifiedSharesAccountIDs
to 0
We should update the condition to remainingTotal <= 0
.
useEffect
callback function when the amount is 0
or a falsy value.
https://github.com/Expensify/App/blob/9c479d7f6b353df21d062cfa2a988e427b32865f/src/components/MoneyRequestConfirmationList.tsx#L489-L494 useEffect(() => {
if (!isTypeSplit || !transaction?.splitShares || !iouAmount) {
return;
}
IOU.adjustRemainingSplitShares(transaction);
}, [isTypeSplit, transaction, iouAmount]);
shouldCalculateDistanceAmount
is true because when shouldCalculateDistanceAmount
is true, we will calculate the amount and set the split, so we don't need to call adjustRemainingSplitShares
.
https://github.com/Expensify/App/blob/9c479d7f6b353df21d062cfa2a988e427b32865f/src/components/MoneyRequestConfirmationList.tsx#L360-L373
After updating waypoints in split distance expense:
0
I don't think 2 is a problem because when new waypoints are updated, all the split shares are re-calculated. Reset button should only appear when any one of them is modified.
For 1, because when we update waypoints, we reset the transaction amount:
Later when we go to confirmation step, adjustRemainingSplitShares
is called with 0
amount causing the split shares for previously-unmodified participants to be 0
:
We should reset the splitShares
as well since after updating the waypoints, this transaction becomes a completely new transaction and all the split shares should be recalculated.
Basically, adjustRemainingSplitShares
should only be called when one of the split shares are modified.
...(isDraft && {amount: CONST.IOU.DEFAULT_AMOUNT, splitShares: CONST.EMPTY_OBJECT}),
@johncschuster Whoops! This issue is 2 days overdue. Let's get this updated quick!
I'm not really sure this behavior is something we will see, let alone something we should optimize. Getting a sense check.
Ok! We discussed this, and it sounds like we do expect this behavior. I'll triage it.
Job added to Upwork: https://www.upwork.com/jobs/~021831341350520719367
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (External
)
The input fields for the other participants become 0, while random amount is calculated for the user that has 0 in input field in Step 5. Reset button also disappears.
When we go back to the distance page and change the way point, we don't reset the splitShares
data before we go to the confirmation page. Then after going to this page again, the splitShares
is calculated wrongly here.
We can do the same way as we do in IOURequestStepAmount
which will reset the split share data before we go to the confirmation page.
Because the new amount will be calculated on the confirmation page and the currency hasn't changed, we only need to pass the transaction to resetSplitShares
function.
if (transaction?.splitShares) {
IOU.resetSplitShares(transaction);
}
if (backTo) {
Navigation.goBack(backTo);
return;
}
NA
@johncschuster, @rushatgabhane Huh... This is 4 days overdue. Who can take care of this?
@nkdengineer's proposal LGTM 🎀 👀 🎀
because they explained the root cause well
Triggered auto assignment to @Beamanator, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.43-6 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-10-10. :confetti_ball:
For reference, here are some details about the assignees on this 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:
@rushatgabhane Do you feel we need a regression test step list? If so, can you provide one?
since QA caught this, I don't think we need a regression test here.
$250 approved for @rushatgabhane
@Beamanator, @johncschuster, @rushatgabhane, @nkdengineer Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Looks like we can close this one up then. Thanks, everyone!
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.26-2 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
The individual split amount will be recalculated and equal split will be populated in the input field for each participant.
Actual Result:
The input fields for the other participants become 0, while random amount is calculated for the user that has 0 in input field in Step 5. Reset button also disappears.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/a637a37d-e9d4-4ed9-9381-0478ede90013
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @johncschuster