Skip to content

[HOLD for payment 2024-01-31] [$500] Category & Tag - Category/Tag used in Split Scan request does not appear in the Recent section #33768

Closed

Description

@kbecciv

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: v1.4.19-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:

Precondition:

  • User is an employee of a Collect workspace.
  • The workspace has categories and tags.
  1. Go to workspace chat > + > Split bill > Scan.
  2. Create a split scan request with a category.
  3. Click on the split scan preview.
  4. Manually enter amount and merchant (this step is not necessary).
  5. Click + > Request money > Manual.
  6. Enter amount > Next > Show more.
  7. Click Category.

Expected Result:

The category previously selected for split scan request is present in Recent section.

Actual Result:

The category previously selected for split scan request is not present in Recent section.
The same issue happens with Tag in split scan request as well.

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

Bug6328562_1703870746180.20231229_175417.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010b2b5eecc8b4c1e2
  • Upwork Job ID: 1740792236035682304
  • Last Price Increase: 2023-12-29
  • Automatic offers:
    • FitseTLT | Contributor | 28077748

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 29, 2023
  2. melvin-bot commented on Dec 29, 2023

    @melvin-bot
  3. changed the title [-]Category & Tag - Category/Tag used in Split Scan request does not appear in the Recent section[/-] [+][$500] Category & Tag - Category/Tag used in Split Scan request does not appear in the Recent section[/+] on Dec 29, 2023
  4. melvin-bot commented on Dec 29, 2023

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 29, 2023
  6. melvin-bot commented on Dec 29, 2023

    @melvin-bot

    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
  7. melvin-bot commented on Dec 29, 2023

    @melvin-bot

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

  8. FitseTLT commented on Dec 29, 2023

    @FitseTLT
    Contributor

    Proposal

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

    Category & Tag - Category/Tag used in Split Scan request does not appear in the Recent section

    What is the root cause of that problem?

    If we create a split bill request with receipt we use IOU.startSplitBill but we have not implemented the code that saves recentlyUsedTags and recentlyUsedCategories in onyx in IOU.startSplitBill as we did in IOU.splitBill here

    App/src/libs/actions/IOU.js

    Lines 1410 to 1415 in 7d1b0f8

    // Add category to optimistic policy recently used categories when a participant is a workspace
    const optimisticPolicyRecentlyUsedCategories = isPolicyExpenseChat ? Policy.buildOptimisticPolicyRecentlyUsedCategories(participant.policyID, category) : [];
    // Add tag to optimistic policy recently used tags when a participant is a workspace
    const optimisticPolicyRecentlyUsedTags = isPolicyExpenseChat ? Policy.buildOptimisticPolicyRecentlyUsedTags(participant.policyID, tag) : {};

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

    We should implement the logic that saves the recentlyUsedTags and recentlyUsedCategories in IOU.startSplitBill as we did in IOU.splitBill
    here

    App/src/libs/actions/IOU.js

    Lines 1623 to 1624 in 7d1b0f8

    const optimisticData = [
    {

     const recentlyUsedOptimistic = [];
        _.each(participants, (participant) => {
            const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(participant);
            const optimisticPolicyRecentlyUsedCategories = isPolicyExpenseChat ? Policy.buildOptimisticPolicyRecentlyUsedCategories(participant.policyID, category) : [];
    
            // Add tag to optimistic policy recently used tags when a participant is a workspace
            const optimisticPolicyRecentlyUsedTags = isPolicyExpenseChat ? Policy.buildOptimisticPolicyRecentlyUsedTags(participant.policyID, tag) : {};
    
            if (!_.isEmpty(optimisticPolicyRecentlyUsedCategories)) {
                recentlyUsedOptimistic.push({
                    onyxMethod: Onyx.METHOD.SET,
                    key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${participant.policyID}`,
                    value: optimisticPolicyRecentlyUsedCategories,
                });
            }
    
            if (!_.isEmpty(optimisticPolicyRecentlyUsedTags)) {
                recentlyUsedOptimistic.push({
                    onyxMethod: Onyx.METHOD.MERGE,
                    key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${participant.policyID}`,
                    value: optimisticPolicyRecentlyUsedTags,
                });
            }
        });
        const optimisticData = [
            ...recentlyUsedOptimistic,
    
    

    What alternative solutions did you explore? (Optional)

  9. DylanDylann commented on Dec 30, 2023

    @DylanDylann
    Contributor

    Proposal

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

    The category previously selected for split scan request is not present in Recent section.
    The same issue happens with Tag in split scan request as well.

    What is the root cause of that problem?

    In Split Scan Request, we are using startSplitBill function but in this function we don't have any logic to update optimisticPolicyRecentlyUsedCategories and optimisticPolicyRecentlyUsedTags

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

    Note that: we only need to update optimisticPolicyRecentlyUsedCategories and optimisticPolicyRecentlyUsedTags if we split bill (scan request) in a workspace chat (isPolicyExpenseChat === true)

    So that we should add condition to check if the participant is policy expense chat and category/tag is not empty we will update recently used category/tags

    In here

    App/src/libs/actions/IOU.js

    Lines 1645 to 1647 in 8cb48e4

    ];
    const successData = [

    We should add

    if (participants.length === 1 && ReportUtils.isPolicyExpenseChat(participants[0])) {
            const optimisticPolicyRecentlyUsedCategories = Policy.buildOptimisticPolicyRecentlyUsedCategories(participants[0].policyID, category) 
            const optimisticPolicyRecentlyUsedTags = Policy.buildOptimisticPolicyRecentlyUsedTags(participants[0].policyID, tag) 
    
            if (!_.isEmpty(optimisticPolicyRecentlyUsedCategories)) {
                optimisticData.push({
                    onyxMethod: Onyx.METHOD.SET,
                    key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${participants[0].policyID}`,
                    value: optimisticPolicyRecentlyUsedCategories,
                });
            }
    
            if (!_.isEmpty(optimisticPolicyRecentlyUsedTags)) {
                optimisticData.push({
                    onyxMethod: Onyx.METHOD.MERGE,
                    key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${participants[0].policyID}`,
                    value: optimisticPolicyRecentlyUsedTags,
                });
            }
        }
    

    One more thing, we are using the same logic to update recently used category/tags in many places. So we should create new utils function to dry code

    What alternative solutions did you explore? (Optional)

    NA

  10. melvin-bot commented on Jan 1, 2024

    @melvin-bot

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

  11. 23 remaining items

  12. melvin-bot commented on Jan 24, 2024

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  13. melvin-bot commented on Jan 24, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.30-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2024-01-31. 🎊

    For reference, here are some details about the assignees on this issue:

  14. melvin-bot commented on Jan 24, 2024

    @melvin-bot

    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:

    • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
    • [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@parasharrajat] Determine if we should create a regression test for this bug.
    • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@JmillsExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  15. JmillsExpensify commented on Jan 31, 2024

    @JmillsExpensify
    Contributor

    @parasharrajat Do you mind helping with the BZ checklist?

  16. JmillsExpensify commented on Jan 31, 2024

    @JmillsExpensify
    Contributor

    In the meantime, payment summary as follows:

  17. JmillsExpensify commented on Jan 31, 2024

    @JmillsExpensify
    Contributor

    Contributor has been paid out, and C+ is paid via Expensify, so closing out this issue and we can handle the checklist/regression decisions ahead of that step.

  18. parasharrajat commented on Feb 5, 2024

    @parasharrajat
    Member

    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:

    • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR: No PR is responsible for the issue. We never implemented the required changes on the startSplitBill flow while adding it to only splitbill. I consider the presence of two functions to be the cause of this issue as it is easy to miss one flow while updating one. We should have only one abstract function which might switch flow as per need.
    • [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: NA
    • [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: NA
    • [@parasharrajat] Determine if we should create a regression test for this bug. Yes
    • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

    Regression Test Steps

    Note:
    1. User is an employee of a Collect workspace.
    2. The workspace has categories and tags 8+ each.

    1. Go to workspace chat > + > Split bill > Scan.
    2. Create a split scan request with a category and tag.
    3. Click on the split scan preview.
    4. Manually enter the amount and merchant (this step is not necessary).
    5. Click + > Request money > Manual.
    6. Enter amount > Next > Show more.
    7. Click Category and verify that the category you selected in (2) is listed under recent categories
    8. Click Tag and verify that the tag you selected in (2) is listed under recent tags.

    Do you agree 👍 or 👎 ?

  19. JmillsExpensify commented on Feb 10, 2024

    @JmillsExpensify
    Contributor

    That sounds good to me. I created a regression test, so at this point I'm waiting on the money request in Expensify and I'll come back to approve.

  20. parasharrajat commented on May 13, 2024

    @parasharrajat
    Member

    Payment requested as per #33768 (comment)

  21. JmillsExpensify commented on May 19, 2024

    @JmillsExpensify
    Contributor

    Need someone else on the BZ team to confirm that this payment summary is right before I can approve payment.

  22. mallenexpensify commented on May 20, 2024

    @mallenexpensify
    Contributor

    Contributor: @FitseTLT paid $500 via Upwork
    Contributor+: @parasharrajat owed $500 via NewDot

  23. JmillsExpensify commented on May 31, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @parasharrajat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions