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

Mileage rate is 0.00 for the newly created workspace instead of the rate set in the policy #10877

Closed
kavimuru opened this issue Sep 7, 2022 · 13 comments
Assignees
Labels
DeployBlockerCash This issue or pull request should block deployment Engineering Hourly KSv2 Reviewing Has a PR in review

Comments

@kavimuru
Copy link

kavimuru commented Sep 7, 2022

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Issue found when executing #10692

Action Performed:

  1. Go to URL https://staging.new.expensify.com/
  2. Create a New Workspace
  3. Go to to Settings -> [Workspace] -> Reimburse expenses
  4. Try to change the mileage rate and the mi/km selector

Expected Result:

  1. Mileage rate should display the value you have in your policy
  2. The mileage rate should be editable
  3. The miles/km selector must be operational

Actual Result:

  1. A new workspace is created with 0.00 milage rate (the rate is set in this policy)
  2. When you try to edit the mileage rate, you get an error
  3. Cannot change miles to kilometers

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Mobile Web

Version Number: v1.1.97-7
Reproducible in staging?: Y
Reproducible in production?: N
Email or phone of affected tester (no customers): applausetester+ihchat4@applause.expensifail.com / Yulia1986Gerets
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: https://user-images.githubusercontent.com/43996225/188964955-fd47cd77-6122-44e9-b33b-956300963889.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

View all open jobs on GitHub

@kavimuru kavimuru added the DeployBlockerCash This issue or pull request should block deployment label Sep 7, 2022
@OSBotify
Copy link
Contributor

OSBotify commented Sep 7, 2022

👋 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
Copy link

melvin-bot bot commented Sep 7, 2022

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

@Julesssss
Copy link
Contributor

Julesssss commented Sep 7, 2022

Damn, this is a new regression occurring from another blocker fix.

@Expensify/mobile-deployers

@yuwenmemon
Copy link
Contributor

Looks like the workspace is undefined in Onyx when we first create it?
Screen Shot 2022-09-07 at 1 25 10 PM

When I refresh the page and open the page again, the mileage rate shows and can be updated:

Screen Shot 2022-09-07 at 1 33 07 PM

@yuwenmemon
Copy link
Contributor

Oh, interesting. The PolicyID changed for the workspace...

@yuwenmemon
Copy link
Contributor

Actually wait no, I think the problem is that there are two custom units on the initially created policy...
Screen Shot 2022-09-07 at 1 40 49 PM

@yuwenmemon
Copy link
Contributor

So somewhere we're not keying the customUnit by the ID when we update Onyx 🤔

@yuwenmemon
Copy link
Contributor

yuwenmemon commented Sep 7, 2022

I would guess it's this line:

customUnits: lodashGet(fullPolicyOrPolicySummary, 'value.customUnits', {}),

@yuwenmemon
Copy link
Contributor

Hm no actually it's coming from the CreateWorkspace API command:
Screen Shot 2022-09-07 at 2 19 42 PM

@yuwenmemon
Copy link
Contributor

Hm yeah - so the problem is that the structure with which we hold Custom Units in OldDot is as an array:

Screen Shot 2022-09-07 at 2 25 22 PM

But in NewDot we want it to be an object keyed by the CustomUnitID:
Screen Shot 2022-09-07 at 2 26 51 PM

@yuwenmemon
Copy link
Contributor

Ah yep, so @amyevans @jasperhuangg we just missed one spot here - we also want to do the data massaging we do in Getting the policy when we Create the policy as well.

@yuwenmemon yuwenmemon added the Reviewing Has a PR in review label Sep 7, 2022
@Julesssss
Copy link
Contributor

Thanks so much, this works perfectly 😍

Fixed.mov

Screenshot_20220908-010228

@amyevans
Copy link
Contributor

amyevans commented Sep 8, 2022

Oh goodness, thanks for fixing @yuwenmemon and @Julesssss ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DeployBlockerCash This issue or pull request should block deployment Engineering Hourly KSv2 Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

5 participants