-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Feature: Import/Export Per Diem Rates #52209
Conversation
@Gonals Can you please let me know when export command is deployed for testing? |
@thesahindia Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@thesahindia Please ignore this PR. @c3024 Can you please do the review here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting so that it appears on my K2.
Lots of conflicts! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If one of the currencies in the rates in spreadsheet is not valid the app crashes
Screen.Recording.2024-11-23.at.3.13.42.PM.mov
because of this
const MemoizedNumberFormat = memoize(Intl.NumberFormat, {maxSize: 10, monitoringName: 'NumberFormatUtils'}); |
One way to fix this is sanitize the currency here
App/src/libs/NumberFormatUtils/index.ts
Lines 9 to 16 in 3ebe852
function format(locale: ValueOf<typeof CONST.LOCALES>, number: number, options?: Intl.NumberFormatOptions): string { | |
return new MemoizedNumberFormat(locale, options).format(number); | |
} | |
function formatToParts(locale: ValueOf<typeof CONST.LOCALES>, number: number, options?: Intl.NumberFormatOptions): Intl.NumberFormatPart[] { | |
return new MemoizedNumberFormat(locale, options).formatToParts(number); | |
} |
with
const sanitizedCurrency = (currency: string): string => Intl.supportedValuesOf('currency').includes(currency) ? currency : CONSTANT.CURRENCY.USD;
function format(locale: ValueOf<typeof CONST.LOCALES>, number: number, options?: Intl.NumberFormatOptions): string {
if (options?.style === 'currency') {
options.currency = sanitizedCurrency(options.currency ?? CONSTANT.CURRENCY.USD);
}
return new MemoizedNumberFormat(locale, options).format(number);
}
function formatToParts(locale: ValueOf<typeof CONST.LOCALES>, number: number, options?: Intl.NumberFormatOptions): Intl.NumberFormatPart[] {
if (options?.style === 'currency') {
options.currency = sanitizedCurrency(options.currency ?? CONSTANT.CURRENCY.USD);
}
return new MemoizedNumberFormat(locale, options).formatToParts(number);
}
@c3024 Have you checked the flow with iOS/Android native device? Can you please check if not yet checked? |
It fails on iOS too and this suggestion of using |
errors={isValidationEnabled ? validate() : undefined} | ||
columnRoles={columnRoles} | ||
isButtonLoading={isImportingPerDiemRates} | ||
learnMoreLink={CONST.IMPORT_SPREADSHEET.CATEGORIES_ARTICLE_LINK} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gonals Can you provide me a link to put in learn more when importing spreadsheet?
@c3024 Fixed the crash. |
|
||
const spreadsheetColumns = spreadsheet?.data; | ||
if (!spreadsheetColumns) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@c3024 I will use Not Found Page that was used throughout the App here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but if we use this, we will encounter the “Not Found” page when the RHP gets dismissed on clicking ok on the confirmation modal. This page is not meant to be accessed via a deeplink anyway. So, leaving it as it was might be better, especially since I just noticed that the import tag and categories page also use the same null return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screen.Recording.2024-11-25.at.6.47.32.PM.mov
@shubham1206agra, is this ready for re-review by @c3024? |
Reviewer Checklist
Screenshots/VideosAndroid: NativespreadAndroid.mp4Android: mWeb ChromeScreenrecorder-2024-11-27-16-22-58-226.mp4Screenrecorder-2024-11-27-16-23-25-876.mp4iOS: NativespreadiOS.mp4iOS: mWeb SafarispreadiOSmWeb-compressed.mp4MacOS: Chrome / SafarispreadChrome.mp4MacOS: DesktopspreadDesktop.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/Gonals in version: 9.0.69-1 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.0.69-4 🚀
|
Explanation of Change
Fixed Issues
$ #50863
$ #50865
Tests
(If rates are empty)
3. Click on import spreadsheet from either empty modal or three dot menu.
4. Upload a valid spreadsheet for per diem rates.
5. Click on Import.
(If there are rates available)
3. Click on Download CSV to download the rates.
Offline tests
NA
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
Screen.Recording.2024-11-21.at.3.54.20.PM.mov
iOS: Native
Screen.Recording.2024-11-21.at.4.04.48.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-11-21.at.3.43.53.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-11-21.at.3.32.46.PM.mov
MacOS: Desktop
Screen.Recording.2024-11-21.at.4.00.54.PM.mov