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

feat: support token filter with translated value [DHIS2-15757] #15730

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

vietnguyen
Copy link
Contributor

@vietnguyen vietnguyen commented Nov 17, 2023

https://dhis2.atlassian.net/browse/DHIS2-15757

Summary

  • Current api filter identifiable:token:aaa search for records using those fields : uid, code, name, shortName. However the filter does not support search by translated value with user selected locale.

Solution

  • Add a jsonb function jsonb_search_translated_token which looks up the token in translations jsonb column instead of the default column.
  • The logic of choosing translations or default columns for querying depends on UserSetting DB_LOCALE and SystemSetting DB_LOCALE. We only query translations column if user locale is different from system locale.

Test

  • Added tests in CrudControllerIntegrationTest

Copy link

codecov bot commented Nov 17, 2023

Codecov Report

Merging #15730 (bc80840) into master (77a9662) will increase coverage by 0.00%.
Report is 3 commits behind head on master.
The diff coverage is 88.88%.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #15730   +/-   ##
=========================================
  Coverage     66.29%   66.29%           
- Complexity    31365    31374    +9     
=========================================
  Files          3485     3485           
  Lines        129967   129992   +25     
  Branches      15197    15203    +6     
=========================================
+ Hits          86158    86179   +21     
- Misses        36720    36724    +4     
  Partials       7089     7089           
Flag Coverage Δ
integration 50.05% <88.88%> (+0.03%) ⬆️
integration-h2 32.33% <0.00%> (-0.01%) ⬇️
unit 30.26% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...in/java/org/hisp/dhis/query/planner/QueryPath.java 38.88% <100.00%> (+12.22%) ⬆️
...hisp/dhis/hibernate/jsonb/type/JsonbFunctions.java 0.00% <ø> (ø)
...a/org/hisp/dhis/query/operators/TokenOperator.java 80.76% <92.30%> (+9.34%) ⬆️
...g/hisp/dhis/query/planner/DefaultQueryPlanner.java 70.76% <81.81%> (+1.02%) ⬆️

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77a9662...bc80840. Read the comment docs.

Copy link

sonarqubecloud bot commented Nov 17, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@vietnguyen vietnguyen self-assigned this Nov 17, 2023
@vietnguyen vietnguyen merged commit 681ac83 into master Nov 17, 2023
18 checks passed
@vietnguyen vietnguyen deleted the DHIS2-15757-41 branch November 17, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants