Skip to content
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

Reports -Total field displays extra zeros and incorrect spacing in saved search #57696

Open
3 of 8 tasks
lanitochka17 opened this issue Mar 3, 2025 · 2 comments
Open
3 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 3, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.1.8-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Tap Reports → Filter and enter all fields till Currency with random details
  3. Tap Save Search
  4. Note in Search Query how the amount entered in the Total field is displayed
  5. Note the amount is shown correctly
  6. Tap the Bookmark icon
  7. Tap the three-dot menu next to the saved search
  8. Tap Rename
  9. Note the Total field details

Expected Result:

The Total field should display the amount exactly as entered without any additional zeros
All filter details should have consistent spacing, including the Total field

Actual Result:

The Total field displays the amount with two extra zeros (e.g., 500 appears as 50000)
All filter details are displayed with normal spacing, but the Total field has double spacing

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6760222_1741031198298.Screenrecorder-2025-03-04-01-11-01-866.mp4

View all open jobs on GitHub

@lanitochka17 lanitochka17 added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Mar 3, 2025
Copy link

melvin-bot bot commented Mar 3, 2025

Triggered auto assignment to @johncschuster (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@daledah
Copy link
Contributor

daledah commented Mar 3, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-03-03 21:34:57 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

The Total field displays the amount with two extra zeros (e.g., 500 appears as 50000)
All filter details are displayed with normal spacing, but the Total field has double spacing

What is the root cause of that problem?

All filter details are displayed with normal spacing, but the Total field has double spacing

When building query string:

function buildQueryStringFromFilterFormValues(filterValues: Partial<SearchAdvancedFiltersForm>) {

We have the following logics:

DATE_FILTER_KEYS.forEach((dateKey) => {
const dateFilter = buildDateFilterQuery(filterValues, dateKey);
filtersString.push(dateFilter);
});

This part will push filter values for date, submitted, approved, paid, exported, posted to filtersString.
However, this function:

function buildDateFilterQuery(filterValues: Partial<SearchAdvancedFiltersForm>, filterKey: SearchDateFilterKeys) {
const dateBefore = filterValues[`${filterKey}${CONST.SEARCH.DATE_MODIFIERS.BEFORE}`];
const dateAfter = filterValues[`${filterKey}${CONST.SEARCH.DATE_MODIFIERS.AFTER}`];
let dateFilter = '';
if (dateBefore) {
dateFilter += `${filterKey}<${dateBefore}`;
}
if (dateBefore && dateAfter) {
dateFilter += ' ';
}
if (dateAfter) {
dateFilter += `${filterKey}>${dateAfter}`;
}
return dateFilter;
}

will return empty string if dateBefore and dateAfter is undefined.

This leads to filtersString has some empty string in it, so joining will leave some extra spaces.

Image

What changes do you think we should make in order to solve the problem?

We should filter out empty string before joining filtersString

return filtersString.join(' ').trim();

return filtersString.filter(Boolean).join(' ').trim();

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

None

What alternative solutions did you explore? (Optional)

NA

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2
Projects
None yet
Development

No branches or pull requests

3 participants