-
Notifications
You must be signed in to change notification settings - Fork 3k
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 2023-10-09] HIGH: LHN logic is broken for paid reports #26669
Comments
Job added to Upwork: https://www.upwork.com/jobs/~0159fb834042f1a338 |
Triggered auto assignment to @adelekennedy ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor Plus for review of internal employee PR - @mananjadhav ( |
Taking this as part of waves |
@JmillsExpensify, @mananjadhav 6 days overdue. This is scarier than being forced to listen to Vogon poetry! |
Adding this to wave4 so that we ensure it gets picked up. |
Closed #26542 in favour of this one, posting my findings from there here as well: I have tried to get to the bottom of this but its getting quite convoluted with all the perspectives and if user is owed or its settled. Its doable just the logic is getting too tricky and its prone to cause some regressions in future. Might have to clean this up a bit. I will move this to weekly and will look into it later. Maybe @koko57 or @BeeMargarida would be interested in taking this on. Currently the getReportPreviewMessage for both Money report and the workspace or IOU chat last message in LHN. But its misleading and I think we should separate the logic of the report preview action and the paid report action message into two functions Then I think we should simplify the translations that in case of expense report, the paid message will always include the Policy name same as in case of |
This does not have to be internal, but he logic is quite complicated at this point and we are reusing the same getReportPreviewMessage method to get the message for report preview and also for the money report, which was fine until we have added more than an admin role and I think we need to separate this. I think it would be a good issue for some agency |
@mountiny I'm currently working on another ticket but as I'm waiting for a PR review I can have a look 🙂 |
🎉 lets do this! Let us know if things are not clear from the issue body? I think we will have to split the |
@mountiny @JmillsExpensify the second line should be: "TEST paid 3.00 elsewhere"? |
Correct, In this case there will be the workspace name twice |
@mountiny I've found the culprit here: Lines 291 to 292 in 95c9e47
and then added to the lastMessageTextFromReport here Line 293 in 95c9e47
but as we don't add the payer to the string like here Line 1467 in 95c9e47
but we pass only amount Line 1459 in 95c9e47
we end up with incomplete string for the workspace admin Starting working on my proposal, I guess the solution can be easy to implement and won't require splitting the logic of getReportPreviewMessage for the report and policyExpenseChat, but I need to check if it won't cause any regressions. PS. I also wondered why it works properly for 'owes' action -> we pass payer's name to the string and the condition for adding the name with colon is false - the lastActorAccountId is 0. Is it correct behavior? |
and one more question: we don't need the ":" after the workspace/payer's name? |
Still waiting on the checklist and then we can close this out. |
I am not sure if we should treat this as a regression as I couldn't find a PR where we had this messaging requirement. @mountiny do you have that? Hence, I don't have a specific offending PR. But I do feel we should add a regression test. QA Steps from the PR look good to me. |
@mananjadhav I agree finding the regression for this can be tricky due to complexity of the LHN code Can you comment the steps here so its easier for the bugZero assignee to handle? Thanks! |
Great reason that we need a regression test for this case. @mananjadhav do you mind suggesting one please? |
Regression Test proposal:
Also should we create a new issue for @trjExpensify's comment ? |
I agree with Manan that this PR did not touch the logic of who the action is coming from. And it feels like the subscript in of the paid expense report, that could be mixture of the backend changes to return both participants in the expense report and this change. Either way we made this logic exteremely brittle depending of various things and these never ending regressions are consequence of it. I am not sure how to tackle this. @koko57 we could try to abstract away some of the logic to determine to LHN preview messages and then create unit tests for that method based on various scenarios of the reports, would that be feasible? |
@trjExpensify on your comment: #26669 (comment) could you please explain what is wrong here? My PR is only adding "[LAST_ACTOR_NAME]:" where necessary (it was originally also adding the workspace name for the workspace requests #27700 (comment)). @mountiny @trjExpensify So we want to display a different message in the chat (with the payer's name) and the workspace name in the sidebar? |
@koko57 I dont think this comes from your PR as it tested well there, there must have been some other change. However, if you have time to investigate that would be helpful And yeah you are correct, in the LHN we should show the Workspace paid, but in the expense report itself for auditing purposes we should show which person actually paid cc @trjExpensify |
You're talking about the title of the expenseReport in the LHN, yeah? |
Ah, so no.. the preview is of the report action added to the report and should come from whichever user took the action. When someone pays an expenseReport:
I.e Report Action
LHN
|
Yup, the workspace chat preview is correct because it's a preview of the report which title updated in (2) above. |
P.S. Regression test has been added. |
$500 payment approved for @mananjadhav based on this summary. |
@JmillsExpensify @mountiny should I start working on this one? 🙂 Will a new ticket be created? |
New issue would be helpful and I can help with the review. |
Yes @trjExpensify would you be able to create a new one for this? You will be the best in defining exactly what needs to be done |
Thanks this can be closed then ❤️ |
Correct logic as follows:
policyExpenseChat
(member view)%workspaceName%
(note: name depends on who’s looking at it, this is the member case)%workspaceName% paid %amount%
Report (member & admin)
%workspaceName% paid %amount%
)%userDisplayName% paid %amount%
At the moment the
policyExpenseChat
is incorrectly showing the second line from the report (e.g. Niki paid...) instead of what should should actually be the second line for thepolicyExpenseChat
.Example
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: