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.36k stars 2.79k forks source link

[HOLD for Payment 2024-09-3][$125] Categorizing - Distance rate list is empty when workspace is non-existent during categorizing #46008

Closed lanitochka17 closed 3 weeks ago

lanitochka17 commented 2 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: 9.0.10-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

Expected Result:

Rate list should display the workspace distance rate

Actual Result:

Rate list is empty This issue only happens when there is no workspace in the account

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/a2975fb4-3b6a-42ca-8ba1-c4f9bfb30cdb

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b13e9e624d638835
  • Upwork Job ID: 1818860377251381062
  • Last Price Increase: 2024-08-30
  • Automatic offers:
    • dominictb | Contributor | 103403381
Issue OwnerCurrent Issue Owner: @allroundexperts
melvin-bot[bot] commented 2 months ago

Triggered auto assignment to @adelekennedy (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

lanitochka17 commented 2 months ago

@adelekennedy FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

lanitochka17 commented 2 months ago

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

dominictb commented 2 months ago

Proposal

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

Rate list is empty This issue only happens when there is no workspace in the account

What is the root cause of that problem?

There're 2 problems:

  1. We're getting rates from policy

https://github.com/Expensify/App/blob/c47208e8539085321183d6f9210b4220acd7cab4/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx#L118

It's not correct, since after users click categorize it, we just create the draft policy -> rates are undefined

  1. In MoneyRequestConfirmationList we're getting mileageRates so it will be empty object

https://github.com/Expensify/App/blob/c47208e8539085321183d6f9210b4220acd7cab4/src/components/MoneyRequestConfirmationList.tsx#L909

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

  1. we should get the policyDraft and rateDrafts and get the actual policy/rates as what we already did in here

In IOURequestStepDistanceRate

    const policy = policyReal ?? policyDraft
    const rates = isEmpty(rates) ? rateDrafts : rates

... 
const IOURequestStepDistanceRateWithOnyx = withOnyx<IOURequestStepDistanceRateProps, IOURequestStepDistanceRateOnyxProps>({
...
export default withOnyx<MoneyRequestConfirmationListProps, MoneyRequestConfirmationListOnyxProps>({
...
    policyDraft: {
        key: ({reportDraft, transaction}) => `${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${IOU.getIOURequestPolicyID(transaction, reportDraft)}`,
    },
    rateDrafts: {
        key: ({reportDraft, transaction}) => `${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${IOU.getIOURequestPolicyID(transaction, reportDraft)}`,
        selector: (policy: OnyxEntry<Policy>) => DistanceRequestUtils.getMileageRates(policy),
    },
  1. Get the draft mileageRates In MoneyRequestConfirmationList
    const mileageRates = isEmpty(mileageRatesReal) ? mileageRatesDraft: mileageRatesReal;
...

...
    mileageRatesDraft: {
        key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${policyID}`,
        selector: (policy: OnyxEntry<OnyxTypes.Policy>) => DistanceRequestUtils.getMileageRates(policy),
    },

What alternative solutions did you explore? (Optional)

NA

Result

https://github.com/user-attachments/assets/a8ea1516-d322-4d10-8f01-5f6d8786d1d8

melvin-bot[bot] commented 2 months ago

@adelekennedy Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] commented 2 months ago

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

melvin-bot[bot] commented 2 months ago

Job added to Upwork: https://www.upwork.com/jobs/~01b13e9e624d638835

melvin-bot[bot] commented 2 months ago

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

allroundexperts commented 1 month ago

@dominictb's proposal looks good to me. It has the correct RCA and the proposed solution works as well.

πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed

melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @tgolen, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] commented 1 month ago

πŸ“£ @dominictb πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

melvin-bot[bot] commented 1 month ago

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

melvin-bot[bot] commented 1 month ago

This issue has not been updated in over 15 days. @tgolen, @allroundexperts, @adelekennedy, @dominictb 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!

tgolen commented 1 month ago

Monthly Update

Next Steps

ETA

melvin-bot[bot] commented 1 month ago

Upwork job price has been updated to $125

ikevin127 commented 1 month ago

Coming from @tgolen's comment in https://github.com/Expensify/App/issues/47914#issuecomment-2321481090, since that issue was closed and ⚠️ automation did not kick in here for the 2nd (regression) PR which I reviewed as C+ and require payment for -> this should be on [HOLD for Payment 2024-09-3] according to 4 days ago production deploy from https://github.com/Expensify/App/pull/48016#issuecomment-2311254152.

cc @adelekennedy

adelekennedy commented 1 month ago

It sounds like the only payments due here are for the PR review from @ikevin127

allroundexperts commented 4 weeks ago

I think I might be eligible for half the payment since I reviewed the original PR.

ikevin127 commented 3 weeks ago

cc @adelekennedy For payments today since the issue has Monthly label and might've got buried.

ikevin127 commented 3 weeks ago

@adelekennedy Bump for payment πŸ’Έ

ikevin127 commented 3 weeks ago

@adelekennedy Bump for payment, day 3 πŸ™ˆ

adelekennedy commented 3 weeks ago

Payouts due:

ikevin127 commented 3 weeks ago

@adelekennedy Offer accepted, thank you! πŸ’―

dominictb commented 3 weeks ago

Hi @adelekennedy, I'm also due payment here as I'm the assigned contributor who raised the PR for this issue.

Could you please take a look? πŸ™