-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD for payment 2023-10-13] [$500] Chat - App does not allow pasting number if numbers has comma in end for english and vice versa #28548
Comments
ProposalPlease re-state the problem that we are trying to solve in this issue.Pasting amount like 20, is not shown in the new request amount page. What is the root cause of that problem?We are using this regex here App/src/libs/MoneyRequestUtils.ts Lines 45 to 48 in bfda42d
to validate the amount and this regex requires at least a digit to be followed by comma to be valid. If the amount is not valid it just sets the previous amount. What changes do you think we should make in order to solve the problem?I think since we are allowing 20. as valid it is reasonable to allow 20, also as valid. const decimalNumberRegex = new RegExp(/^\d+(,\d*)?(\.\d{0,2})?$/, 'i'); This accepts 20, but disallows 20,,, this is in line with the present regex allowing 20. but not 20... What alternative solutions did you explore? (Optional) |
Triggered auto assignment to @sonialiap ( |
Job added to Upwork: https://www.upwork.com/jobs/~017fcdbf8f05309fae |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.App does not allow pasting number if numbers has comma in end for english and vice versa. What is the root cause of that problem?The root cause of the problem lies in the regular expression used for validation. The current regex pattern doesn't account for numbers that end with a comma. App/src/libs/MoneyRequestUtils.ts Line 46 in bfda42d
What changes do you think we should make in order to solve the problem?To address this issue, we should update the regular expression used for number validation to accommodate numbers with a trailing comma.
Result |
@c3024 @Krishna2323 Thanks for the proposals, modifying this regex works but can either of you tell me why pasting a trailing comma works for when the language is set to English but not to Spanish? |
, and . are interchanged in Spanish. So we can paste 20, in Spanish but not 20. @Ollyws |
With the existing regex 20, works for Spanish but not English. 20. works for English but not for Spanish.
Which regex does this? As far as I see, existing regex allows 20, for Spanish but not for English. New regex allows 20, for both. |
@c3024 Thanks for the explanation. Sorry I meant |
Once it passes the validity check ',' ('.') are stripped in English (Spanish) here
So I think allowing (or disallowing) 1,. (or for that matter 1.,) is a non-issue. Restricting (or allowing) regex for these cases is not necessary in my opinion. But if we want to restrict our regex to allow only const decimalNumberRegex = new RegExp(/^(\d+(,\d+)*)+(\.\d{0,2})?$|^\d+\.$|^(\d+,)+$/, 'i'); With this regex Screen.Recording.2023-10-01.at.11.06.49.PM.mov |
Triggered auto assignment to @luacmartins, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Yeah they changed the |
@Ollyws, that's the reason I commented a proposal here, the provided proposal was not working correctly. |
Thanks for you proposal but @c3024 posted the general solution first, and it includes the correct solution (albeit with one extraneous character) so I think it's fair to go with their proposal. |
@Ollyws okay, thanks for clarification, I was just trying to point out that the original proposal will not work. |
Yes I noticed this, I don't think it's necessarily unwanted behaviour as we strip all the commas anyway. |
@Ollyws, currently we disallow number with multiple commas, in our staging version we can't paste "10,,,0" |
Yes I am aware of this. |
📣 @Ollyws 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @c3024 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Thanks for reviewing the proposals @Ollyws! |
📣 @dhanashree-sawant 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app! |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.78-4 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 2023-10-13. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
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:
|
BugZero Checklist: |
@Ollyws, @sonialiap, @luacmartins, @c3024 Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Agreed with @Ollyws's assessment. I believe we're just pending payment. |
@Ollyws review + bonus = $750 - paid ✔️ |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
App should allow copy pasting number in request money with comma in end as it allows copy paste of number with comma in middle or copy paste of number with full stop in end (English language)
Actual Result:
App does not allow copy pasting number in request money with comma in end for English language and it doesn't allow copy paste number with full stop in end for Spanish language
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.74-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
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
Notes/Photos/Videos: Any additional supporting documentation:
windows.chrome.comma.or.fullstop.in.english.or.spanish.in.end.does.not.paste.amount.mp4
Recording.115.mp4
android.native.does.not.allow.to.paste.numbers.with.comma.1.mp4
Ipste.mp4
Ipse2.mp4
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695835603519559
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: