Add support for groupBy week in Search - v2#80833
Conversation
🦜 Polyglot Parrot! 🦜Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues: View the translation diffdiff --git a/src/languages/de.ts b/src/languages/de.ts
index 211b1dc7..651a0934 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -7001,7 +7001,7 @@ Fordere Spesendetails wie Belege und Beschreibungen an, lege Limits und Standard
[CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'Auszahlungs-ID',
[CONST.SEARCH.GROUP_BY.CATEGORY]: 'Kategorie',
[CONST.SEARCH.GROUP_BY.MERCHANT]: 'Händler',
- [CONST.SEARCH.GROUP_BY.TAG]: 'Stichwort',
+ [CONST.SEARCH.GROUP_BY.TAG]: 'Tag',
[CONST.SEARCH.GROUP_BY.MONTH]: 'Monat',
[CONST.SEARCH.GROUP_BY.WEEK]: 'Woche',
},
diff --git a/src/languages/it.ts b/src/languages/it.ts
index dd80e98c..2263ad62 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -6989,7 +6989,7 @@ Richiedi dettagli di spesa come ricevute e descrizioni, imposta limiti e valori
[CONST.SEARCH.GROUP_BY.CARD]: 'Carta',
[CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'ID prelievo', //_/\__/_/ \_,_/\__/\__/\_,_/
[CONST.SEARCH.GROUP_BY.CATEGORY]: 'Categoria',
- [CONST.SEARCH.GROUP_BY.MERCHANT]: 'Commerciante',
+ [CONST.SEARCH.GROUP_BY.MERCHANT]: 'Esercente',
[CONST.SEARCH.GROUP_BY.TAG]: 'Etichetta',
[CONST.SEARCH.GROUP_BY.MONTH]: 'Mese',
[CONST.SEARCH.GROUP_BY.WEEK]: 'Settimana',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 5088ce87..f49e5e62 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -6925,10 +6925,10 @@ ${reportName}
reimbursable: '精算対象',
purchaseCurrency: '購入通貨',
groupBy: {
- [CONST.SEARCH.GROUP_BY.FROM]: '送信者',
+ [CONST.SEARCH.GROUP_BY.FROM]: '開始',
[CONST.SEARCH.GROUP_BY.CARD]: 'カード',
[CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: '出金ID',
- [CONST.SEARCH.GROUP_BY.CATEGORY]: 'カテゴリー',
+ [CONST.SEARCH.GROUP_BY.CATEGORY]: 'カテゴリ',
[CONST.SEARCH.GROUP_BY.MERCHANT]: '加盟店',
[CONST.SEARCH.GROUP_BY.TAG]: 'タグ',
[CONST.SEARCH.GROUP_BY.MONTH]: '月',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 8a8ccfda..202fad61 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -6972,7 +6972,7 @@ Vraag verplichte uitgavedetails zoals bonnetjes en beschrijvingen, stel limieten
[CONST.SEARCH.GROUP_BY.CARD]: 'Kaart',
[CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'Opname-ID',
[CONST.SEARCH.GROUP_BY.CATEGORY]: 'Categorie',
- [CONST.SEARCH.GROUP_BY.MERCHANT]: 'Verkoper',
+ [CONST.SEARCH.GROUP_BY.MERCHANT]: 'Handelaar',
[CONST.SEARCH.GROUP_BY.TAG]: 'Label',
[CONST.SEARCH.GROUP_BY.MONTH]: 'Maand',
[CONST.SEARCH.GROUP_BY.WEEK]: 'Week',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index a1994258..8bc1e2c6 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -6959,10 +6959,10 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i
groupBy: {
[CONST.SEARCH.GROUP_BY.FROM]: 'Od',
[CONST.SEARCH.GROUP_BY.CARD]: 'Karta',
- [CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'ID wypłaty',
+ [CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'Identyfikator wypłaty',
[CONST.SEARCH.GROUP_BY.CATEGORY]: 'Kategoria',
[CONST.SEARCH.GROUP_BY.MERCHANT]: 'Sprzedawca',
- [CONST.SEARCH.GROUP_BY.TAG]: 'Etykieta',
+ [CONST.SEARCH.GROUP_BY.TAG]: 'Tag',
[CONST.SEARCH.GROUP_BY.MONTH]: 'Miesiąc',
[CONST.SEARCH.GROUP_BY.WEEK]: 'Tydzień',
},
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index ba2cea47..523ed16c 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -6960,9 +6960,9 @@ Exija detalhes de despesas como recibos e descrições, defina limites e padrõe
groupBy: {
[CONST.SEARCH.GROUP_BY.FROM]: 'De',
[CONST.SEARCH.GROUP_BY.CARD]: 'Cartão',
- [CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'ID da retirada',
+ [CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: 'ID de saque',
[CONST.SEARCH.GROUP_BY.CATEGORY]: 'Categoria',
- [CONST.SEARCH.GROUP_BY.MERCHANT]: 'Comerciante',
+ [CONST.SEARCH.GROUP_BY.MERCHANT]: 'Estabelecimento',
[CONST.SEARCH.GROUP_BY.TAG]: 'Etiqueta',
[CONST.SEARCH.GROUP_BY.MONTH]: 'Mês',
[CONST.SEARCH.GROUP_BY.WEEK]: 'Semana',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 692863b6..e714f0ff 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -6807,9 +6807,10 @@ ${reportName}
groupBy: {
[CONST.SEARCH.GROUP_BY.FROM]: '来自',
[CONST.SEARCH.GROUP_BY.CARD]: '卡片',
+ //_/\__/_/ \_,_/\__/\__/\_,_/
[CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID]: '提现 ID',
[CONST.SEARCH.GROUP_BY.CATEGORY]: '类别',
- [CONST.SEARCH.GROUP_BY.MERCHANT]: '商家',
+ [CONST.SEARCH.GROUP_BY.MERCHANT]: '商户',
[CONST.SEARCH.GROUP_BY.TAG]: '标签',
[CONST.SEARCH.GROUP_BY.MONTH]: '月',
[CONST.SEARCH.GROUP_BY.WEEK]: '周',
Note You can apply these changes to your branch by copying the patch to your clipboard, then running |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@shubham1206agra 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] |
| // Extract the existing date filter to check for year-to-date or other date limits | ||
| const existingDateFilter = queryJSON.flatFilters.find((filter) => filter.key === CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE); | ||
| const {start: weekStart, end: weekEnd} = adjustTimeRangeToDateFilters(DateUtils.getWeekDateRange(item.week), existingDateFilter); | ||
| const newFlatFilters = queryJSON.flatFilters.filter((filter) => filter.key !== CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE); |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
This code block for creating date filters with week ranges is duplicated in src/libs/SearchUIUtils.ts (lines 2451-2463 in getWeekSections). The logic for filtering and rebuilding flatFilters with date range operators appears in two locations.
Impact: Duplicated logic increases maintenance burden and bug risk. If the filter creation logic needs to change, it must be updated in both places.
Suggested fix: Extract this logic into a reusable utility function:
function createDateFilterForWeek(
queryJSON: SearchQueryJSON,
week: string
): SearchQueryJSON | undefined {
const existingDateFilter = queryJSON.flatFilters.find(
(filter) => filter.key === CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE
);
const {start: weekStart, end: weekEnd} = adjustTimeRangeToDateFilters(
DateUtils.getWeekDateRange(week),
existingDateFilter
);
const newFlatFilters = queryJSON.flatFilters.filter(
(filter) => filter.key \!== CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE
);
newFlatFilters.push({
key: CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE,
filters: [
{operator: CONST.SEARCH.SYNTAX_OPERATORS.GREATER_THAN_OR_EQUAL_TO, value: weekStart},
{operator: CONST.SEARCH.SYNTAX_OPERATORS.LOWER_THAN_OR_EQUAL_TO, value: weekEnd},
],
});
const newQueryJSON: SearchQueryJSON = {
...queryJSON,
groupBy: undefined,
flatFilters: newFlatFilters
};
const newQuery = buildSearchQueryString(newQueryJSON);
return buildSearchQueryJSON(newQuery);
}Then use it in both locations instead of duplicating the logic.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b01dce32ba
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-01-28.at.11.27.38.PM.movScreen.Recording.2026-01-29.at.1.32.51.PM.mov |
| return Object.values(CONST.SEARCH.DATE_PRESETS).some((datePreset) => datePreset === value); | ||
| } | ||
|
|
||
| function adjustTimeRangeToDateFilters(timeRange: {start: string; end: string}, dateFilter: QueryFilters[0] | undefined): {start: string; end: string} { |
There was a problem hiding this comment.
@cristipaval Follow up task. Please add tests for all these functions as it is really complex in nature.
|
✋ 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/lakchote in version: 9.3.11-16 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.3.12-1 🚀
|
Explanation of Change
Adding groyp by week again after being reverted
Fixed Issues
$ #80396
$ #80814
$ #80818
PROPOSAL:
Tests
Tests
Prerequisites:
Test 1: Access Group by Week via Advanced Filters
Test 2: Verify Week Grouping Display (Large Screen)
groupBy:weekfilterTest 3: Verify Week Grouping Display (Small Screen)
groupBy:weekfilterTest 4: Verify Week Grouping Across Multiple Weeks
groupBy:weekTest 5: Verify Week Expand/Collapse
groupBy:weekappliedTest 6: Verify Sorting
groupBy:weekTest 7: Verify Multi-select Checkbox
groupBy:weekTest 8: Verify Week Grouping Across Year Boundaries
groupBy:weekTest 9: Verify Sunday Transaction Grouping (Critical Edge Case)
groupBy:weekTest 10: Verify Clicking Week Group Filters Transactions
groupBy:weekgroupByis removed from the queryOffline tests
QA Steps
Same as steps.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps./** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-01-27.at.17.34.11.mov