You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Search - The Tax Rate filter does not display results when the query is manually entered #54380
Version Number: 9.0.77-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail:#53688
**Issue reported by:**Applause - Internal Team
Action Performed:
Preconditions:
User has at least one workspace with Taxes enabled.
The user has expenses with the tax rate that will be used to filter the results.
Steps:
Login to ND (can be Gmail or expensifail account)
Go to any chat or expense report
In the Search Router, enter a query using the Tax Rate filter, eg. tax-rate:"Tax Rate 1" and press Intro - or tap the Magnifier button in the keypad -
Expected Result:
The Tax Rate filter displays results when the query is entered manually, similar to when the query is selected from Suggestions or entered in Filters (on the Reports tab)
Actual Result:
The Tax Rate filter does not display results when the query is manually entered
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 evidenceBug6698296_1734552361897.taxRate_filter.mp4
due to this, the results are not visible when manually entering
What changes do you think we should make in order to solve the problem?
We need to replace tax rate names with tax rate ids and similar replacement is being done for email-ids by getQueryWithUpdatedValues which calls getUpdatedFilterValue so, we need to update getUpdatedFilterValue and add logic to replace tax-rate names with their ids.
Update here and here to pass policy id to getUpdatedFilterValue
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We need to add unit tests for getQueryWithUpdatedValues to check if tax rates are being replaced. The new cases will check that tax rates are subsituted properly, tax rate ids are preserved properly and update the existing tests for all subsitutions
Please re-state the problem that we are trying to solve in this issue.
The Tax Rate filter does not display results when the query is manually entered
What is the root cause of that problem?
getUpdatedFilterValue does not update the taxRate or filterValue, in the search payload to its respective tax key or id, eg: "Tax Rate 1" should be converted to id_TAX_RATE_1
Therefore, the backend can not find any results because it searches the tax filter based on the tax IDs or keys instead of its name which is sent to /api/Search? in the built jsonQuery.
What changes do you think we should make in order to solve the problem?
Convert the filterValue if the filterName is CONST.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE to the tax key by finding which tax key the filterValue belongs to.
@lanitochka17 I don't understand this bug - how does a customer know to do this:
In the Search Router, enter a query using the Tax Rate filter, eg. tax-rate:"Tax Rate 1"
i.e how can we guarantee that the query is correct without the list of filters - I tried and clearly didn't get it right.
We don't have any guidance online for how users take this action. I don't think this is something that we need to focus on right now, as we have no current plans for adding this to our help docs.
We already do something similar for from/to filters where from:jay@mail.com will work even if you press enter without using suggestions and the search router is relatively new so maybe this is worth fixing
cc: @luacmartins as they manage search related stuff
The reason it works for emails is that email is a unique identifier. The same cannot be said about other filter/values, e.g. tags, categories, tax rates, etc so in those cases we need to rely on autocomplete.
Activity
melvin-bot commentedon Dec 19, 2024
Triggered auto assignment to @RachCHopkins (
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.jaydamani commentedon Dec 19, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Tax rate filter not working when entering filter manually.
What is the root cause of that problem?
The query send to backend when we manually enter is different from when we search for tax rates
When we manually enter, it is:
{"operator":"eq","left":"taxRate","right":"Tax Rate 1"}When we select from suggestions, it is:
{"operator":"eq","left":"taxRate","right":"id_TAX_RATE_1"}due to this, the results are not visible when manually entering
What changes do you think we should make in order to solve the problem?
We need to replace tax rate names with tax rate ids and similar replacement is being done for email-ids by getQueryWithUpdatedValues which calls getUpdatedFilterValue so, we need to update getUpdatedFilterValue and add logic to replace tax-rate names with their ids.
App/src/libs/SearchQueryUtils.ts
Lines 204 to 225 in 8fb9cf7
We need to add policy id as param for getUpdatedFilterValue and then add below code in the getUpdatedFilterValue function:
We will also need to add below policy utils to get tax rate id from the names
Update here and here to pass policy id to getUpdatedFilterValue
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We need to add unit tests for getQueryWithUpdatedValues to check if tax rates are being replaced. The new cases will check that tax rates are subsituted properly, tax rate ids are preserved properly and update the existing tests for all subsitutions
Tony-MK commentedon Dec 20, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
The Tax Rate filter does not display results when the query is manually entered
What is the root cause of that problem?
getUpdatedFilterValuedoes not update thetaxRateorfilterValue, in the search payload to its respective tax key or id, eg:"Tax Rate 1"should be converted toid_TAX_RATE_1App/src/libs/SearchQueryUtils.ts
Lines 200 to 204 in 8a4011d
Therefore, the backend can not find any results because it searches the tax filter based on the tax IDs or keys instead of its name which is sent to
/api/Search?in the builtjsonQuery.What changes do you think we should make in order to solve the problem?
Convert the
filterValueif thefilterNameisCONST.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATEto the tax key by finding which tax key thefilterValuebelongs to.Let's add the following statement
getUpdatedFilterValueover hereOptionally, we can create a function to handle the update and simplify
getUpdatedFilterValue.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Test
getUpdatedFilterValuewith other search filters and values.melvin-bot commentedon Dec 23, 2024
@RachCHopkins Whoops! This issue is 2 days overdue. Let's get this updated quick!
RachCHopkins commentedon Dec 24, 2024
@lanitochka17 I don't understand this bug - how does a customer know to do this:
i.e how can we guarantee that the query is correct without the list of filters - I tried and clearly didn't get it right.
We don't have any guidance online for how users take this action. I don't think this is something that we need to focus on right now, as we have no current plans for adding this to our help docs.
jaydamani commentedon Dec 25, 2024
We already do something similar for from/to filters where from:jay@mail.com will work even if you press enter without using suggestions and the search router is relatively new so maybe this is worth fixing
cc: @luacmartins as they manage search related stuff
luacmartins commentedon Dec 30, 2024
The reason it works for emails is that email is a unique identifier. The same cannot be said about other filter/values, e.g. tags, categories, tax rates, etc so in those cases we need to rely on autocomplete.
jaydamani commentedon Dec 30, 2024
I understand now, thanks for the confirmation.