Open lanitochka17 opened 8 months ago
Job added to Upwork: https://www.upwork.com/jobs/~01a008da44d804c493
Triggered auto assignment to @garrettmknight (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External
)
Currently, if you click the "pay" button while a receipt is still scanning, the receipt gets incorrectly marked as paid even though the scan is not finished.
The problem occurs because we don't exclude receipts/reports that are still scanning when you press the "pay" button.
We have two options to solve this:
&& !isScanning
to the relevant code sections. This change will prevent the pay button from appearing if a receipt is still scanning. const shouldShowPayButton = useMemo(
() => isPayer && !isDraftExpenseReport && !iouSettled && !props.iouReport.isWaitingOnBankAccount && reimbursableSpend !== 0 && !iouCanceled && !isScanning,
[isPayer, isDraftExpenseReport, iouSettled, props.iouReport.isWaitingOnBankAccount, reimbursableSpend, iouCanceled, isScanning],
);
and here as well
excludedReportIDs
. This will be an array containing the IDs of receipts that are still scanning. However, this requires creating a new parameter that currently doesn't exist, meaning collaboration with the backend team is needed. then should be used in the getPayMoneyRequest
functionIOU becomes paid while the receipt is scanning.
The ReportPreview
, MoneyReportView
, MoneyRequestPreview
and MoneyRequestView
components all use the ReportUtils.isSettled
function to determine the value of isSettled
or iouSettled
in ReportPreview
.
For IOUs paid elsewhere, ReportUtils.isSettled
only checks if report.statusNum === CONST.REPORT.STATUS.REIMBURSED
, even if a receipt of a transaction is being scanned.
Therefore, the root cause of the problem is that we solely, use isSettled
or iouSettled
to determine whether to show if the IOU is paid or not.
We need to add a condition in all of the respective components to check if a transaction has a receipt that is being scanned. The condition varies from component to component. With this condition, we can properly display the paid checkmark icons when a receipt is being scanned.
1) ReportPreview
For ReportPreview
, iouSettled
is used in many places, hence we should only change the applicable places to avoid regressions.
i) Checkmark Icon
{ReportUtils.isSettled(props.iouReportID) && !numberOfScanningReceipts && (
ii) 'Paid' Text
Unsure if this should be changed, and if so how because I don't think it is expected to look like below.
If we a changing the text, should the text in the MoneyRequestHeader
and MoneyReportHeader
components be changed as well?
https://github.com/Expensify/App/blob/744e35c85157ecef9cdfab81a0ab56891dc507f9/src/components/ReportActionItem/ReportPreview.js#L213
if (iouSettled && !numberOfScanningReceipts || props.iouReport.isWaitingOnBankAccount) {
2) MoneyRequestView
https://github.com/Expensify/App/blob/744e35c85157ecef9cdfab81a0ab56891dc507f9/src/components/ReportActionItem/MoneyRequestView.js#L153
const isSettled = ReportUtils.isSettled(moneyRequestReport.reportID) && (!TransactionUtils.hasReceipt(transaction) || !TransactionUtils.isReceiptBeingScanned(transaction));
3) MoneyRequestPreview
https://github.com/Expensify/App/blob/744e35c85157ecef9cdfab81a0ab56891dc507f9/src/components/ReportActionItem/MoneyRequestPreview.js#L163
const isSettled = ReportUtils.isSettled(props.iouReport.reportID) && !isScanning;
4) MoneyReportView
(Unsure if we should apply this condition to the checkmark)
const isSettled = ReportUtils.isSettled(report.reportID) && !ReportUtils.getTransactionsWithReceipts(report.iouReportID).some((transaction) => TransactionUtils.isReceiptBeingScanned(transaction));
Optional for Granularity
These suggestions are to reduce the chances that the introduced condition will create a regression.
1) Use of TransactionUtils.isAmountMissing(transaction)
in the condition so isSettled
is true
when the amount is manually entered later.
2) We can find the reportAction
which has originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.ELSEWHERE
in the condition to apply the created condition for determining isSettled
only when the IOU is paid elsewhere and not with other methods.
This simple solution will handle all places in which the bug applies but is risky.
We could change the ReportUtils.isSettled
function but I am afraid it may break other functions and components that depend on ReportUtils.isSettled
.
However, if you don't mind we can add an extra condition like previously mentioned to the ReportUtils.isSettled
function.
@garrettmknight, @Ollyws Whoops! This issue is 2 days overdue. Let's get this updated quick!
@Ollyws can you please review the proposals so far?
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
Thanks for the proposals but it seems both may be unclear about the issue.
The problem is not that the pay button is being displayed, it should be displayed as there are other requests and as far as I can see it is not shown if there is only a reciept being scanned.
The problem is that selecting pay elsewhere
marks everything as paid including the reciept (which is in the process of scanning).
Thank you, @Ollyws, for reviewing my proposal, and I apologize for failing to grasp the expected result.
I have updated my proposal based on your comments at https://github.com/Expensify/App/issues/33972#issuecomment-1887569945.
However, there are some questions which I would appreciate if you answer.
Thank you.
Thanks @Ollyws added a second solution to avoid marking scanning receipts as paid.
Will review asap.
@Ollyws can you review the updates when you get a chance?
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@garrettmknight @Ollyws this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@Tony-MK's proposal seems like it's going in the right direction assuming this is entirely a front-end fix. I will have to have a deeper look at exactly what's going on here...
Will have a deeper look into this one tomorrow.
@Tony-MK Thanks for the proposal but there is also the fact that the reciept scan is rendered un-editable when the report is settled, this isn't entirely reliant on the 'isSettled' condition.
Thanks for the heads up, @Ollyws.
Then, I think using !TransactionUtils.isReceiptBeingScanned(transaction)
in the canEditFieldOfMoneyRequest
and canEditMoneyRequest
functions should be enough to render the report as editable.
What do you think? 🤔
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
Couldn't get to this today but should have an answer after the weekend.
Will get to this one tomorrow.
It seems that if we enable editing for a settled request that is currently being scanned and try to change the amount, the backend will return a This request cannot be edited
error suggesting that this issue will require some work on the backend so it should really be internal.
@garrettmknight @Ollyws this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:
Thanks!
Current assignee @Ollyws is eligible for the Internal assigner, not assigning anyone new.
@garrettmknight, @Ollyws Huh... This is 4 days overdue. Who can take care of this?
Current assignee @Ollyws is eligible for the Internal assigner, not assigning anyone new.
Checking with VIP split to see if this fits there: https://expensify.slack.com/archives/C05RECHFBEW/p1707162631162859
Bumped VIP again
Shouldn't be overdue
Adding to vip-split - @youssef-lr can you give this one a look and confirm it needs to be internal?
Going to take a look today @garrettmknight!
@youssef-lr just assigning you to confirm internal v. external. If it's internal we can flag it for all wave7 core.
Triggered auto assignment to @dylanexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
@dylanexpensify just reassigning in case this needs help while I'm OOO this week - will be back 2/21 to pick it back up.
@garrettmknight @dylanexpensify I'll be able to confirm today if this needs to be internal.
@garrettmknight, @youssef-lr, @Ollyws, @dylanexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
I'm able to reproduce and I think this does need to be internal.
nice, thanks @youssef-lr ❤️
@youssef-lr are you taking this on? If so, let's remove hot pick label! 😄
Just assigned @youssef-lr originally to confirm internal or not - leaving hot-pick on for now, but @youssef-lr if you want to pick it up, feel free to assign yourself!
Waiting on hot picks!
Still waiting
Still waiting
I'll work on this next week @garrettmknight
My man! 🤝
Will start investigation tomorrow, I'm not sure I can get to this today.
@garrettmknight I think we can hold this on https://github.com/Expensify/App/issues/35240. The solution is to move the smartscanning expense to a new report. I'm wondering though if #35240 will support IOUs or just expenses? cc @mountiny
I'm not sure - @jasperhuangg might be able to help us understand that too.
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: 1.4.21-1 Reproducible in staging?: Y Reproducible in production?: Y 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 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:
Action Performed:
Expected Result:
Receipt IOU should not be marked as paid
Actual Result:
The receipt IOU is marked as paid before the receipt is done scanning and before account B marks it as paid
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/e56b724f-66d9-413d-894a-58ea09fc7739
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @youssef-lr