@@ -2231,17 +2231,14 @@ function getReportSections({
22312231 return [ reportIDToTransactionsValues , reportIDToTransactionsValues . length ] ;
22322232}
22332233
2234- function buildGroupDrillQuery ( queryJSON : SearchQueryJSON , filterKey : SearchFilterKey , filterValue : string | number ) : SearchQueryJSON | undefined {
2234+ function buildSpecificGroupQuery ( queryJSON : SearchQueryJSON , filterKey : SearchFilterKey , filterValue : string | number ) : SearchQueryJSON | undefined {
22352235 const newFlatFilters = queryJSON . flatFilters . filter ( ( filter ) => filter . key !== filterKey ) ;
22362236 newFlatFilters . push ( { key : filterKey , filters : [ { operator : CONST . SEARCH . SYNTAX_OPERATORS . EQUAL_TO , value : filterValue } ] } ) ;
22372237 const newQueryJSON : SearchQueryJSON = { ...queryJSON , groupBy : undefined , flatFilters : newFlatFilters } ;
22382238 return buildSearchQueryJSON ( buildSearchQueryString ( newQueryJSON ) ) ;
22392239}
22402240
2241- function buildDateRangeGroupDrillQuery (
2242- queryJSON : SearchQueryJSON ,
2243- dateRange : { start : string ; end : string } ,
2244- ) : { transactionsQueryJSON : SearchQueryJSON | undefined ; start : string ; end : string } {
2241+ function buildDateRangeGroupQuery ( queryJSON : SearchQueryJSON , dateRange : { start : string ; end : string } ) : { transactionsQueryJSON : SearchQueryJSON | undefined ; start : string ; end : string } {
22452242 const dateFilters = queryJSON . flatFilters . filter ( ( filter ) => filter . key === CONST . SEARCH . SYNTAX_FILTER_KEYS . DATE ) ;
22462243 const { start, end} = adjustTimeRangeToDateFilters ( dateRange , dateFilters ) ;
22472244 const newFlatFilters = queryJSON . flatFilters . filter ( ( filter ) => filter . key !== CONST . SEARCH . SYNTAX_FILTER_KEYS . DATE ) ;
@@ -2275,7 +2272,7 @@ function getMemberSections(
22752272 const memberGroup = data [ key ] as SearchMemberGroup ;
22762273
22772274 const personalDetails = data . personalDetailsList ?. [ memberGroup . accountID ] ?? emptyPersonalDetails ;
2278- const transactionsQueryJSON = queryJSON && memberGroup . accountID ? buildGroupDrillQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . FROM , memberGroup . accountID ) : undefined ;
2275+ const transactionsQueryJSON = queryJSON && memberGroup . accountID ? buildSpecificGroupQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . FROM , memberGroup . accountID ) : undefined ;
22792276
22802277 memberSections [ key ] = {
22812278 groupedBy : CONST . SEARCH . GROUP_BY . FROM ,
@@ -2312,7 +2309,7 @@ function getCardSections(
23122309 if ( isGroupEntry ( key ) ) {
23132310 const cardGroup = data [ key ] as SearchCardGroup ;
23142311 const personalDetails = data . personalDetailsList ?. [ cardGroup . accountID ] ?? emptyPersonalDetails ;
2315- const transactionsQueryJSON = queryJSON && cardGroup . cardID ? buildGroupDrillQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . CARD_ID , cardGroup . cardID ) : undefined ;
2312+ const transactionsQueryJSON = queryJSON && cardGroup . cardID ? buildSpecificGroupQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . CARD_ID , cardGroup . cardID ) : undefined ;
23162313
23172314 if ( ! cardGroup . cardID ) {
23182315 continue ;
@@ -2360,7 +2357,7 @@ function getWithdrawalIDSections(data: OnyxTypes.SearchResults['data'], queryJSO
23602357 if ( isGroupEntry ( key ) ) {
23612358 const withdrawalIDGroup = data [ key ] as SearchWithdrawalIDGroup ;
23622359 const transactionsQueryJSON =
2363- queryJSON && withdrawalIDGroup . entryID ? buildGroupDrillQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . WITHDRAWAL_ID , withdrawalIDGroup . entryID ) : undefined ;
2360+ queryJSON && withdrawalIDGroup . entryID ? buildSpecificGroupQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . WITHDRAWAL_ID , withdrawalIDGroup . entryID ) : undefined ;
23642361
23652362 if ( ! withdrawalIDGroup . accountNumber ) {
23662363 continue ;
@@ -2395,7 +2392,7 @@ function getCategorySections(data: OnyxTypes.SearchResults['data'], queryJSON: S
23952392
23962393 const transactionsQueryJSON =
23972394 queryJSON && categoryGroup . category !== undefined
2398- ? buildGroupDrillQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . CATEGORY , ! categoryGroup . category ? CONST . SEARCH . CATEGORY_EMPTY_VALUE : categoryGroup . category )
2395+ ? buildSpecificGroupQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . CATEGORY , ! categoryGroup . category ? CONST . SEARCH . CATEGORY_EMPTY_VALUE : categoryGroup . category )
23992396 : undefined ;
24002397
24012398 // Format the category name - decode HTML entities for display, keep empty/none values as-is
@@ -2431,7 +2428,7 @@ function getMerchantSections(data: OnyxTypes.SearchResults['data'], queryJSON: S
24312428
24322429 const transactionsQueryJSON =
24332430 queryJSON && merchantGroup . merchant !== undefined
2434- ? buildGroupDrillQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . MERCHANT , merchantGroup . merchant === '' ? CONST . SEARCH . MERCHANT_EMPTY_VALUE : merchantGroup . merchant )
2431+ ? buildSpecificGroupQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . MERCHANT , merchantGroup . merchant === '' ? CONST . SEARCH . MERCHANT_EMPTY_VALUE : merchantGroup . merchant )
24352432 : undefined ;
24362433
24372434 // Format the merchant name - use translated "No merchant" for empty values so it sorts alphabetically
@@ -2475,7 +2472,11 @@ function getTagSections(data: OnyxTypes.SearchResults['data'], queryJSON: Search
24752472
24762473 const transactionsQueryJSON =
24772474 queryJSON && tagGroup . tag !== undefined
2478- ? buildGroupDrillQuery ( queryJSON , CONST . SEARCH . SYNTAX_FILTER_KEYS . TAG , tagGroup . tag === '' || tagGroup . tag === '(untagged)' ? CONST . SEARCH . TAG_EMPTY_VALUE : tagGroup . tag )
2475+ ? buildSpecificGroupQuery (
2476+ queryJSON ,
2477+ CONST . SEARCH . SYNTAX_FILTER_KEYS . TAG ,
2478+ tagGroup . tag === '' || tagGroup . tag === '(untagged)' ? CONST . SEARCH . TAG_EMPTY_VALUE : tagGroup . tag ,
2479+ )
24792480 : undefined ;
24802481
24812482 // Format the tag name - use translated "No tag" for empty values so it sorts alphabetically
@@ -2512,7 +2513,7 @@ function getMonthSections(data: OnyxTypes.SearchResults['data'], queryJSON: Sear
25122513 continue ;
25132514 }
25142515 const dateResult =
2515- queryJSON && monthGroup . year && monthGroup . month ? buildDateRangeGroupDrillQuery ( queryJSON , DateUtils . getMonthDateRange ( monthGroup . year , monthGroup . month ) ) : undefined ;
2516+ queryJSON && monthGroup . year && monthGroup . month ? buildDateRangeGroupQuery ( queryJSON , DateUtils . getMonthDateRange ( monthGroup . year , monthGroup . month ) ) : undefined ;
25162517 const transactionsQueryJSON = dateResult ?. transactionsQueryJSON ;
25172518
25182519 const monthDate = new Date ( monthGroup . year , monthGroup . month - 1 , 1 ) ;
@@ -2546,7 +2547,7 @@ function getWeekSections(data: OnyxTypes.SearchResults['data'], queryJSON: Searc
25462547 continue ;
25472548 }
25482549 const rawRange = DateUtils . getWeekDateRange ( weekGroup . week ) ;
2549- const dateResult = queryJSON && weekGroup . week ? buildDateRangeGroupDrillQuery ( queryJSON , rawRange ) : undefined ;
2550+ const dateResult = queryJSON && weekGroup . week ? buildDateRangeGroupQuery ( queryJSON , rawRange ) : undefined ;
25502551 const transactionsQueryJSON = dateResult ?. transactionsQueryJSON ;
25512552 const formattedWeek = DateUtils . getFormattedDateRangeForSearch ( dateResult ?. start ?? rawRange . start , dateResult ?. end ?? rawRange . end ) ;
25522553
@@ -2577,7 +2578,7 @@ function getYearSections(data: OnyxTypes.SearchResults['data'], queryJSON: Searc
25772578 continue ;
25782579 }
25792580 const transactionsQueryJSON =
2580- queryJSON && yearGroup . year !== undefined ? buildDateRangeGroupDrillQuery ( queryJSON , DateUtils . getYearDateRange ( yearGroup . year ) ) ?. transactionsQueryJSON : undefined ;
2581+ queryJSON && yearGroup . year !== undefined ? buildDateRangeGroupQuery ( queryJSON , DateUtils . getYearDateRange ( yearGroup . year ) ) ?. transactionsQueryJSON : undefined ;
25812582 const formattedYear = String ( yearGroup . year ) ;
25822583
25832584 yearSections [ key ] = {
@@ -2605,7 +2606,7 @@ function getQuarterSections(data: OnyxTypes.SearchResults['data'], queryJSON: Se
26052606 }
26062607 const transactionsQueryJSON =
26072608 queryJSON && quarterGroup . year !== undefined && quarterGroup . quarter !== undefined
2608- ? buildDateRangeGroupDrillQuery ( queryJSON , DateUtils . getQuarterDateRange ( quarterGroup . year , quarterGroup . quarter ) ) ?. transactionsQueryJSON
2609+ ? buildDateRangeGroupQuery ( queryJSON , DateUtils . getQuarterDateRange ( quarterGroup . year , quarterGroup . quarter ) ) ?. transactionsQueryJSON
26092610 : undefined ;
26102611 const formattedQuarter = DateUtils . getFormattedQuarterForSearch ( quarterGroup . year , quarterGroup . quarter ) ;
26112612
@@ -2811,9 +2812,9 @@ function getSortedSections(
28112812 }
28122813
28132814 if ( groupBy ) {
2814- const sortFn = groupBySortFunction [ groupBy ] ;
2815- if ( sortFn ) {
2816- return sortFn ( data as TransactionGroupListItemType [ ] , localeCompare , sortBy , sortOrder ) ;
2815+ const sortFunction = groupBySortFunction [ groupBy ] ;
2816+ if ( sortFunction ) {
2817+ return sortFunction ( data as TransactionGroupListItemType [ ] , localeCompare , sortBy , sortOrder ) ;
28172818 }
28182819 }
28192820
0 commit comments