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

[Deploy Blocker] Changed max length to 11 for alignment issues #5243

Merged
merged 3 commits into from
Sep 15, 2021

Conversation

akshayasalvi
Copy link
Contributor

@akshayasalvi akshayasalvi commented Sep 14, 2021

@deetergp @marcaaron or anybody can review and merge this on priority?

Details

Fixed Issues

$ #5241
$ #5115

Tests

  1. Tested by switching multiple 3 digit currency symbols

QA Steps

  1. Go to any IOU transaction
  2. Select any 3 digit currency
  3. Enter a very long number
  4. It should restrict to 8 digits without decimal (and 10 digits with decimal) and alignment shouldn't break.
  5. Click the Next button
  6. Choose a person to send the IOU request to
  7. Enter a reason, confirm
  8. Make sure the IOU is created and that no error message is returned

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Screenshot 2021-09-14 at 9 32 18 AM

Screen.Recording.2021-09-15.at.12.00.58.AM.mov

Mobile Web

Screenshot 2021-09-14 at 9 35 35 AM

Updated with 10 digits
https://user-images.githubusercontent.com/57435789/133314295-be399ca0-63ad-4089-939f-d45d6e9f1cfb.mov

Desktop

image

iOS

Screenshot 2021-09-14 at 9 57 53 AM

Android

image

@akshayasalvi akshayasalvi requested a review from a team as a code owner September 14, 2021 04:11
@MelvinBot MelvinBot requested review from marcaaron and removed request for a team September 14, 2021 04:11
src/CONST.js Outdated
@@ -362,7 +362,7 @@ const CONST = {
PAYPAL_ME: 'PayPal.me',
VENMO: 'Venmo',
},
AMOUNT_MAX_LENGTH: 14,
AMOUNT_MAX_LENGTH: 11,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented on the deploy blocker, but I think this needs to be 10, our backend shouldn't allow 11 digits (assuming we use the name amount for the parameter when calling the API)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sorry, small correction. The max is 10 digits when given amount is in cents. So for example you can use enter:

$12345678.91 because 12345678.91 * 100 = 1234567891 and is 10 digits, but you cannot enter the amount 1234567890, because 1234567890 * 100 = 123456789000 is 12 digits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I've updated the PR to 10 digits now.

@francoisl
Copy link
Contributor

The tests should include creating the IOU though please, otherwise there's no point in fixing the UI if the backend won't allow the amount you enter. This is the error you receive if you try to complete the flow with the amount in the tests:

image

@akshayasalvi
Copy link
Contributor Author

@francoisl I've updated the PR with the 10 digit check.

But I am not sure how to add tests (I've never done that earlier). Can you help with this and I'll add those.

@marcaaron marcaaron removed their request for review September 14, 2021 20:27
@@ -362,7 +362,7 @@ const CONST = {
PAYPAL_ME: 'PayPal.me',
VENMO: 'Venmo',
},
AMOUNT_MAX_LENGTH: 14,
AMOUNT_MAX_LENGTH: 10,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So as I explained here, we always use amounts in cents in the Expensify backend, so if for example you type $1.23, then we use the amount 123. If you type $20, then we send 2000.
The amount in cents is what needs to be 10 digits max, so we need to multiply the amount to check in validateAmount() by 100 first.

Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I somehow misunderstood. I've updated the PR with the new cent logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Limits are 8 digits without decimal and 10 digit with decimal.

Screenshot 2021-09-15 at 11 29 47 PM

Screenshot 2021-09-15 at 11 29 39 PM

@akshayasalvi
Copy link
Contributor Author

The tests should include creating the IOU though please, otherwise there's no point in fixing the UI if the backend won't allow the amount you enter. This is the error you receive if you try to complete the flow with the amount in the tests:

Are you asking me to add a test case to an existing one? or are you asking me to write a fresh new unit test case? Can you please confirm?

@francoisl
Copy link
Contributor

francoisl commented Sep 15, 2021

Are you asking me to add a test case to an existing one?

No - just in the QA steps section, update the instructions to say to complete the entire flow, so:

  1. Enter an amount
  2. Click the Next button
  3. Choose a person to send the IOU request to
  4. Enter a reason, confirm
  5. Make sure the IOU is created and that no error message is returned

But I tested on my end and it's working.

@akshayasalvi
Copy link
Contributor Author

Update the QA steps. Thanks a lot, @francoisl for your help.

@github-actions
Copy link
Contributor

⚠️ ⚠️ Heads up! This pull request has the CP Staging label. ⚠️ ⚠️
Merging it will cause it to be immediately deployed to staging, even if the open StagingDeployCash deploy checklist is locked.

@francoisl francoisl merged commit 09dd0bf into Expensify:main Sep 15, 2021
github-actions bot pushed a commit that referenced this pull request Sep 15, 2021
[Deploy Blocker] Changed max length to 11 for alignment issues

(cherry picked from commit 09dd0bf)
@isagoico
Copy link

isagoico commented Sep 15, 2021

@francoisl @akshayasalvi We're able to use 11 digits with decimals instead of 10

@francoisl
Copy link
Contributor

Ah, good catch. It only works if the last digit is 0 though, and for example $1.000 is strictly equal to $1.00. All that matters is that the amount in cents (so, multiplied by 100) is no longer than 10 digits. Overall, this shouldn't cause any issue with creating the IOU, so I'd say let's ignore it.

@isagoico
Copy link

Great then! We can check this off 🎉

@akshayasalvi
Copy link
Contributor Author

I had explicitly tested .000 and ignored because it wasn't breaking any backend or UI flow.

@botify
Copy link

botify commented Sep 15, 2021

This has been deployed to production and is now subject to a 7-day regression period.
If no regressions arise, payment will be issued on 2021-09-22. 🎊

@OSBotify
Copy link
Contributor

🚀 Cherry-picked to staging by @francoisl in version: 1.0.98-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @francoisl in version: 1.0.98-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @francoisl in version: 1.0.98-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @Jag96 in version: 1.0.99-4 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants