Skip to content
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

[$500] IOU - On workspace chat, category of previously created expense is auto-assigned #32234

Closed
6 tasks done
lanitochka17 opened this issue Nov 29, 2023 · 34 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 29, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.5-3
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:

Pre-requisite: user must be a member of a workspace as an employee

  1. Go to workspace chat
  2. Create a money request and select a category
  3. Create another money request, but do not select any category

Expected Result:

The most recent expense should not have any category assigned

Actual Result:

The category of the most recent expense is auto-assigned to the one selected on the previous money request

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6295208_1701295598305.bandicam_2023-11-29_16-54-10-551.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010fc799cb6c6c36b1
  • Upwork Job ID: 1729989330099601408
  • Last Price Increase: 2023-12-06
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 29, 2023
@melvin-bot melvin-bot bot changed the title IOU - On workspace chat, category of previously created expense is auto-assigned [$500] IOU - On workspace chat, category of previously created expense is auto-assigned Nov 29, 2023
Copy link

melvin-bot bot commented Nov 29, 2023

Triggered auto assignment to @JmillsExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

Copy link

melvin-bot bot commented Nov 29, 2023

Job added to Upwork: https://www.upwork.com/jobs/~010fc799cb6c6c36b1

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 29, 2023
Copy link

melvin-bot bot commented Nov 29, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Nov 29, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External)

@unidev727
Copy link
Contributor

App/src/libs/actions/IOU.js

Lines 183 to 186 in ef3d8cd

onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`,
value: transaction,
},

Here we are setting transaction data like category, merchant and so on
but if a transaction data contains an empty category value in RequestMoney API, the backend is likely set to the previously selected category in RequestMoney API call.

App/src/libs/actions/IOU.js

Lines 874 to 898 in ef3d8cd

API.write(
'RequestMoney',
{
debtorEmail: payerEmail,
debtorAccountID: payerAccountID,
amount,
currency,
comment,
created,
merchant,
iouReportID: iouReport.reportID,
chatReportID: chatReport.reportID,
transactionID: transaction.transactionID,
reportActionID: iouAction.reportActionID,
createdChatReportActionID,
createdIOUReportActionID,
reportPreviewReportActionID: reportPreviewAction.reportActionID,
receipt,
receiptState: lodashGet(receipt, 'state'),
category,
tag,
billable,
},
onyxData,
);

@DylanDylann
Copy link
Contributor

DylanDylann commented Nov 30, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

  • IOU - On workspace chat, category of previously created expense is auto-assigned

What is the root cause of that problem?

  • Currently, when creating money request, if user does not select the category, BE will auto create a money request with the category of the previous request.

What changes do you think we should make in order to solve the problem?

  • We can create the default category for each policy. Do it by:
  1. First, create an onyx collection, for example INITIAL_POLICY_CATEGORY to store the initial category for each policy.
  2. Create a set method for this collection
function setInitialCategory(policyID, category) {
    Onyx.set(`${ONYXKEYS.COLLECTION.INITIAL_POLICY_CATEGORY}${policyID}`, category)
}
  1. Subscribe the ONYXKEYS.COLLECTION.INITIAL_POLICY_CATEGORY in MoneyRequestConfirmPage
  2. Update:
    iouCategory={props.iou.category}

    to:
                        iouCategory={props.iou.category || props.initialCategory}

or add the useEffect to MoneyRequestConfirmPage to check if the props.iou.category is empty or not, if true, set the initialCategory to it like below:

    useEffect(() => {
        if (props.iou.category) {
            IOU.setMoneyRequestCategory(props.initialCategory);
        }
    }, [props.iou.category, props.initialCategory]);

What alternative solutions did you explore? (Optional)

  • NA

@melvin-bot melvin-bot bot added the Overdue label Dec 2, 2023
Copy link

melvin-bot bot commented Dec 4, 2023

@JmillsExpensify, @eVoloshchak Eep! 4 days overdue now. Issues have feelings too...

@JmillsExpensify
Copy link

@eVoloshchak Mind commenting on the proposals so far?

@melvin-bot melvin-bot bot removed the Overdue label Dec 6, 2023
Copy link

melvin-bot bot commented Dec 6, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Dec 8, 2023
Copy link

melvin-bot bot commented Dec 11, 2023

@JmillsExpensify, @eVoloshchak Huh... This is 4 days overdue. Who can take care of this?

@eVoloshchak
Copy link
Contributor

Currently, when creating money request, if user does not select the category, BE will auto create a money request with the category of the previous request.

@DylanDylann, while we could resolve this on the front end with your fix, I think we should resolve it on the back end itself. Are there advantages you'd think of of fixing this on FE?

@melvin-bot melvin-bot bot removed the Overdue label Dec 11, 2023
@DylanDylann
Copy link
Contributor

@eVoloshchak

  • If the user creates a lot of request money sequentially, they do not need to re-select the category (This is a feature request rather than a bug). We need to confirmation from internal team. cc @JmillsExpensify
  • But we also need to fix from the BE side that if the payload does not contain category data, do not auto-assign the previous category.

@JmillsExpensify
Copy link

I don't think we want that feature at the moment, so let's make sure this gets fixed in the backend.

@JmillsExpensify JmillsExpensify added Internal Requires API changes or must be handled by Expensify staff and removed External Added to denote the issue can be worked on by a contributor labels Dec 13, 2023
Copy link

melvin-bot bot commented Dec 13, 2023

Current assignee @eVoloshchak is eligible for the Internal assigner, not assigning anyone new.

Copy link

melvin-bot bot commented Dec 13, 2023

@JmillsExpensify @eVoloshchak this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Dec 15, 2023
Copy link

melvin-bot bot commented Dec 18, 2023

@JmillsExpensify, @eVoloshchak Eep! 4 days overdue now. Issues have feelings too...

Copy link

melvin-bot bot commented Dec 20, 2023

@JmillsExpensify, @eVoloshchak Still overdue 6 days?! Let's take care of this!

Copy link

melvin-bot bot commented Dec 22, 2023

@JmillsExpensify, @eVoloshchak Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

@eVoloshchak
Copy link
Contributor

@JmillsExpensify, could you assign an internal engineer to this please?
The only thing we need is the BE fix (#32234 (comment))

fix from the BE side that if the payload does not contain category data, do not auto-assign the previous category.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 22, 2023
Copy link

melvin-bot bot commented Dec 26, 2023

@JmillsExpensify, @eVoloshchak Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Dec 27, 2023

@JmillsExpensify @eVoloshchak this issue is now 4 weeks old and preventing us from maintaining WAQ. This should now be your highest priority. Please post below what your plan is to get a PR in review ASAP. Thanks!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 27, 2023
@JmillsExpensify
Copy link

Still waiting to be picked up internal.

@melvin-bot melvin-bot bot removed the Overdue label Dec 27, 2023
@JmillsExpensify JmillsExpensify added Internal Requires API changes or must be handled by Expensify staff and removed Internal Requires API changes or must be handled by Expensify staff labels Dec 27, 2023
Copy link

melvin-bot bot commented Dec 27, 2023

Current assignee @eVoloshchak is eligible for the Internal assigner, not assigning anyone new.

Copy link

melvin-bot bot commented Dec 27, 2023

Triggered auto assignment to @MonilBhavsar (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@MonilBhavsar
Copy link
Contributor

I am not able to reproduce, I sus that the policy has category expense rules set and it is auto categorising the expense?
@eVoloshchak are you able to reproduce?

@MonilBhavsar
Copy link
Contributor

@lanitochka17 is is still reproducible?

I sus that the policy has category expense rules set and it is auto categorising the expense?

To confirm this suspicion, could you please check if policy has any category expense rules set, or try requesting money on a new workspace chat, thanks!

@melvin-bot melvin-bot bot added the Overdue label Jan 1, 2024
Copy link

melvin-bot bot commented Jan 1, 2024

@JmillsExpensify, @eVoloshchak, @MonilBhavsar Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

1 similar comment
Copy link

melvin-bot bot commented Jan 1, 2024

@JmillsExpensify, @eVoloshchak, @MonilBhavsar Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@MonilBhavsar
Copy link
Contributor

Not sure if this is bug #32234 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Jan 1, 2024
@MonilBhavsar
Copy link
Contributor

@lanitochka17 @eVoloshchak @JmillsExpensify are you able to reproduce?
If not, we can close this bug

@eVoloshchak
Copy link
Contributor

@MonilBhavsar, unable to reproduce this one

@lanitochka17
Copy link
Author

I am not able to reproduce with latest build 1.4.21-3

Recording.865.mp4

@MonilBhavsar
Copy link
Contributor

Thanks for checking. Closing this issue then. Feel free to reopen if issues is reproducible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

6 participants