Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.11k stars 2.61k forks source link

Web - Request Money - Category Not Automatically Added When Requesting Money in Distance Mode #39304

Open kbecciv opened 3 months ago

kbecciv commented 3 months ago

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.58.0 Reproducible in staging?: y Reproducible in production?: n Issue reported by: Applause - Internal Team

Action Performed:

1, Open the FAB menu and select "Request Money." 2, Choose the distance mode option. 3, Enter start and end points, then click "Next." 4, Select workspace chat. 5, Observe that the Category field remains empty and is not automatically filled.

Expected Result:

The Category, labeled as "Car," should be automatically added when requesting money in distance mode.

Actual Result:

The Category field is not automatically populated when requesting money in distance mode.

Workaround:

n/a

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/93399543/5ebb7110-1a5f-4a70-9d0c-2fa05dfac24e

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01495c58bc9b570f5d
  • Upwork Job ID: 1773872837983576064
  • Last Price Increase: 2024-03-30
github-actions[bot] commented 3 months ago

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.
melvin-bot[bot] commented 3 months ago

Triggered auto assignment to @francoisl (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

kbecciv commented 3 months ago

We think that this bug might be related to #vip-split

allgandalf commented 3 months ago

Both the policies are different in the video, so one might have default category as car and the other might now, is this really a bug @kbecciv ?? c.c. @francoisl

francoisl commented 3 months ago

I can reproduce the issue, using the same workspace on staging and prod, and the category is being prefilled correctly in production.

allgandalf commented 3 months ago

Proposal

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

Category is not automatically show for distance requests

What is the root cause of that problem?

When i console log the customUnits of a policy i see that now we get 2 objects of the name distance: Screenshot from 2024-03-30 04-38-52

And we have taken the default category condition such that we will store the deafultcategory value without checking if defaultCategory exists : customUnit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE https://github.com/Expensify/App/blob/54c669f18d1d8b676f7bdd0fd7af655d931a6943/src/pages/iou/request/step/IOURequestStepConfirmation.js#L152-L156

And this causes a empty string to be stored as now we have 2 objects with the name distance

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

Add a condition to check if the matching object has defaultCategory field, so the updated query would be:

    const defaultCategory = lodashGet(
        _.find(lodashGet(policy, 'customUnits', {}), (customUnit) => customUnit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE && customUnit.defaultCategory),
        'defaultCategory',
        '',
    );

What alternative solutions did you explore? (Optional)

N/A

allgandalf commented 3 months ago

@francoisl i was able to reproduce the issue, this seems to be the case now that we get 2 objects for the same name distance

allgandalf commented 3 months ago

Also reason why this is not reproducible on production is because, we recently changed the default workspace creation from Free to Collect now the response changes to give us 2 objects, you can test this with a free workspace on staging and you will observe that this bug is not reproducible there :)

This is the console log for a free workspace: image

VS collect workspace:

image

This is NAB i think

francoisl commented 3 months ago

This will be a backend fix, going to remove the label for now.

melvin-bot[bot] commented 3 months ago

Job added to Upwork: https://www.upwork.com/jobs/~01495c58bc9b570f5d

melvin-bot[bot] commented 3 months ago

Triggered auto assignment to Contributor Plus for review of internal employee PR - @fedirjh (Internal)

francoisl commented 3 months ago

It will be handled internally, no need for a C+ here.

melvin-bot[bot] commented 2 months ago

@francoisl Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] commented 2 months ago

@francoisl 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] commented 2 months ago

@francoisl 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

melvin-bot[bot] commented 2 months ago

@francoisl 12 days overdue now... This issue's end is nigh!

melvin-bot[bot] commented 2 months ago

This issue has not been updated in over 14 days. @francoisl eroding to Weekly issue.

melvin-bot[bot] commented 1 month ago

This issue has not been updated in over 15 days. @francoisl eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!