Repository navigation
Read the CSV card identity from the mapped column instead of the row's last cell - #101569
Conversation
…s last cell buildOptimisticCompanyCardCSVTransactions looked up the Card number column only, so with that column unmapped the index was -1 and row.at(-1) read whatever cell sat last in the row. With Unique ID mapped, that is the last optional column the user chose (Tag, Description, Category); a blank cell there made the row fail the identity check, drop out of the success count, and skip the yyyy-MM-dd date normalization even though it was still sent. Resolve the identity column once, Card number then Card name, and read it only when it resolved.
|
@dubielzyk-expensify @QichenZhu One of you needs to 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] |
garrettmknight
left a comment
There was a problem hiding this comment.
Looks good from a product perspecitve.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen_recording_20260925_020321.webmAndroid: mWeb ChromeScreen_recording_20260925_020506.webmiOS: HybridAppSimulator.Screen.Recording.-.iPhone.17.-.2026-09-25.at.01.59.28.moviOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.17.-.2026-09-25.at.02.02.20.movMacOS: Chrome / Safarimac-web-pr.movmac-web-staging.mov |
| const cardName = cardIdentityColumnIndex >= 0 ? row.at(cardIdentityColumnIndex)?.trim() : undefined; | ||
| const rawPostedDate = row.at(postedDateColumnIndex)?.trim(); | ||
| const created = rawPostedDate ? parseCSVDate(rawPostedDate) : null; | ||
| const merchant = row.at(merchantColumnIndex)?.trim() ?? ''; | ||
| const currency = row.at(currencyColumnIndex)?.trim(); | ||
| const amountValue = row.at(amountColumnIndex) ?? ''; |
There was a problem hiding this comment.
Good catch! Using .at() without > 0 check is error prone.
date, mechant, currency, amount fields are mandatory, so they are not affected.
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 tylerkaraszewski has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/tylerkaraszewski in version: 9.4.94-0 🚀
|
|
No help site changes are needed for this PR, so I didn't create a docs PR. This PR fixes a bug. It doesn't add or rename any feature. The help article already describes the fixed behavior:
Before this PR, rows with a blank trailing optional column were skipped when only Card name was mapped. That made the app disagree with the article. The fix brings the app in line with the article. It adds no UI labels, settings, or steps. What changedIn @mukhrr, I didn't create a help site PR because none is needed. If you think the article should mention this fix, reply with |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.94-0 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
With Card number unmapped,
buildOptimisticCompanyCardCSVTransactionsgets index -1 androw.at(-1)reads the last cell of the row as the card identity, so any row with a blank trailing optional column is skipped: wrong count in the success modal and no date normalization for that row. The identity column is now resolved once (Card number, else Card name) and only read when it exists.Fixed Issues
$ #98774
PROPOSAL: #98774 (comment)
Tests
Precondition: a workspace admin with Company cards enabled, and a CSV with columns
Unique ID, Card Name, Date, Merchant, Amount, Currency, Tagholding 3 rows, each with a card name, where Tag is blank on 2 of them.Offline tests
The Import button is disabled while offline, so the flow cannot be started. The change only affects how the request payload and success count are built on press, it adds no network surface.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.app.mp4
Android: mWeb Chrome
android_web.mp4
iOS: Native
ios_app.mp4
iOS: mWeb Safari
ios.web.mp4
MacOS: Chrome / Safari
web.mp4