-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[$1000] IOU - Total amount is changed if user is canceling the amount in USD (first request) #12779
Comments
Triggered auto assignment to @davidcardoza ( |
Current assignee @davidcardoza is eligible for the External assigner, not assigning anyone new. |
I was able to reproduce, sending out to external. Job posted - https://www.upwork.com/jobs/~0113dfaeac3d495f2e |
Job added to Upwork: https://www.upwork.com/jobs/~017f20fafc88928bb6 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr ( |
Triggered auto assignment to @marcochavezf ( |
Proposalthe problem is caused by if (currency !== iouReport.currency && isNetworkOffline) {
Solutionadjust the logic by the type + if (type === 'cancel' ? (currency === iouReport.currency) : (currency !== iouReport.currency) && isNetworkOffline) {
- if (currency !== iouReport.currency && isNetworkOffline) {
return iouReport;
} Resultrecored.movNoteI think it's not best proposal. maybe you can give more explanation about the logic, like why total amount should not changed only if currency is different, etc.. |
I don't see what's wrong here. Looks logical to me.
|
Yep, agree with @s77rt as the cancel request has the same currency (USD). |
The change should be updated when going online. |
@mollfpr What would be the expected results then? |
Same as in the description, the total amount should be updated when online. Also please check the related issue #12433 |
@mollfpr I believe that the total amount when canceling a money request with a different currency should be updated only when online because we need to consider the exchange rate that could change, which is being also mentioned in the 4th step of the related issue. Canceling a money request with the same currency won't get affected by the exchange rate, and thus should not be prevented to be updated when offline, right? |
Proposal
which looks like this I imagine this property is always the same as the backend values, it doesnt get updated if we do actions like request or cancel locally (not yet synced to backend) and this will be the first time it will be used in this repo because I searched it and I only seen it on create report. using this approach would regress the requirement about updating the amount when same currency but I can also work on that I'll send the video in a moment |
Btw, in case we still want to prevent it, here is my proposal Proposal function updateIOUOwnerAndTotal(iouReport, actorEmail, amount, currency, type = CONST.IOU.REPORT_ACTION_TYPE.CREATE) {
- if (currency !== iouReport.currency && isNetworkOffline) {
+ if (isNetworkOffline) {
return iouReport;
}
const iouReportUpdate = {...iouReport};
if (actorEmail === iouReport.ownerEmail) {
iouReportUpdate.total += type === CONST.IOU.REPORT_ACTION_TYPE.CANCEL ? -amount : amount;
} else {
iouReportUpdate.total += type === CONST.IOU.REPORT_ACTION_TYPE.CANCEL ? amount : -amount;
}
if (iouReportUpdate.total < 0) {
// The total sign has changed and hence we need to flip the manager and owner of the report.
iouReportUpdate.ownerEmail = iouReport.managerEmail;
iouReportUpdate.managerEmail = iouReport.ownerEmail;
iouReportUpdate.total = -iouReportUpdate.total;
}
return iouReportUpdate;
} |
Thanks guys, I’ll review the proposal tomorrow! |
Hi this is the followup video for #12779 (comment) Screen.Recording.2022-11-20.at.12.15.41.AM.movas you can see in the video, the and the component cachedTotal is coming from this App/src/components/ReportActionItem/IOUPreview.js Lines 126 to 130 in 503aa36
just shaping the values for display In theory, we can use the |
@mollfpr i think this is the logical behavior here , the |
Sorry, I just have enough time to understand the issue and scroll back to the related discussion. I agree with y'all that the current logic makes sense. In the meantime, I'll hold off reviewing the proposals until we have a clear explanation of the expected result. @kbecciv Could you clarify if the IOU amount should not be updated before going online although the currency is the same as the IOU report currency? |
This is the expected behavior when the the request cancelled has the same currency as the IOU report, as per this issue: #12433. Thank you all for your proposals! Closing this one out. |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Issue was found when executing PR #12488
Action Performed:
Expected Result:
Total amount is not changed if user is canceling the amount in USD (first request)
Actual Result:
Total amount is changed if user is canceling the amount in USD (first request)
Workaround:
Unknown
Platform:
Where is this issue occurring?
Version Number: 1.2.28.0
Reproducible in staging?: Yes
Reproducible in production?: Yes
Email or phone of affected tester (no customers): any
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Screen_Recording_20221115-220706_New.Expensify.1.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: