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

Map search bug fixes #3516

Merged
merged 22 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c54d8ba
- Updating the infinite scroll paging
dubdabasoduba Sep 23, 2024
37a5ec8
- spotless apply
dubdabasoduba Sep 23, 2024
0016007
- Fix breaking tests on geo widget module
dubdabasoduba Sep 24, 2024
6d8477a
- Fix tests
dubdabasoduba Sep 25, 2024
552be3f
- Run spotless
dubdabasoduba Sep 25, 2024
6b034e8
Merge branch 'main' into feature/fix_infinite_scroll_page
dubdabasoduba Sep 25, 2024
cb48a2d
- Import `LazyPagingItems`
dubdabasoduba Sep 25, 2024
2042bc1
Merge branch 'main' of github.com:opensrp/fhircore into feature/fix_i…
dubdabasoduba Sep 28, 2024
3db24ca
Merge branch 'main' into feature/fix_infinite_scroll_page
dubdabasoduba Sep 30, 2024
7aac63f
Merge branch 'main' into feature/fix_infinite_scroll_page
dubdabasoduba Sep 30, 2024
7d561d5
Merge branch 'main' into feature/fix_infinite_scroll_page
dubdabasoduba Oct 1, 2024
d45e555
- Adding tests
dubdabasoduba Oct 2, 2024
23c2a62
Merge branch 'main' of github.com:opensrp/fhircore into feature/fix_i…
dubdabasoduba Oct 7, 2024
2150606
Merge branch 'feature/fix_infinite_scroll_page' of github.com:opensrp…
dubdabasoduba Oct 7, 2024
cfcf8cb
Merge branch 'main' of github.com:opensrp/fhircore into feature/fix_i…
dubdabasoduba Oct 9, 2024
eb77da0
Merge branch 'main' into feature/fix_infinite_scroll_page
Lentumunai-Mark Oct 14, 2024
53939d1
- Update the APK naming
dubdabasoduba Oct 14, 2024
d75f98e
Merge branch 'feature/fix_infinite_scroll_page' of github.com:opensrp…
dubdabasoduba Oct 14, 2024
6a803db
Ignore test to be refactored later
ellykits Oct 14, 2024
8eb4415
Merge branch 'feature/fix_infinite_scroll_page' of github.com:opensrp…
ellykits Oct 14, 2024
9c9533a
- Run spotless
dubdabasoduba Oct 14, 2024
41fecd7
Update kujaku version.
Lentumunai-Mark Oct 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1070,14 +1070,20 @@
if (currentPage != null && pageSize != null) {
val fromIndex = currentPage * pageSize
val toIndex = (currentPage + 1) * pageSize
with(searchResults.subList(fromIndex, min(toIndex, searchResults.size))) {
mapResourceToRepositoryResourceData(
relatedResourcesConfig = relatedResourcesConfig,
configComputedRuleValues = configComputedRuleValues,
secondaryResourceConfigs = secondaryResourceConfigs,
filterActiveResources = filterActiveResources,
baseResourceConfig = baseResourceConfig,
)
val maxSublistIndex = min(toIndex, searchResults.size)

Check warning on line 1073 in android/engine/src/main/java/org/smartregister/fhircore/engine/data/local/DefaultRepository.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/data/local/DefaultRepository.kt#L1073

Added line #L1073 was not covered by tests

if (fromIndex < maxSublistIndex) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add an edge case unit test for when we only have one item in the searchResults (if there's none already)

with(searchResults.subList(fromIndex, maxSublistIndex)) {
mapResourceToRepositoryResourceData(
relatedResourcesConfig = relatedResourcesConfig,
configComputedRuleValues = configComputedRuleValues,
secondaryResourceConfigs = secondaryResourceConfigs,
filterActiveResources = filterActiveResources,
baseResourceConfig = baseResourceConfig,

Check warning on line 1082 in android/engine/src/main/java/org/smartregister/fhircore/engine/data/local/DefaultRepository.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/data/local/DefaultRepository.kt#L1076-L1082

Added lines #L1076 - L1082 were not covered by tests
)
}
} else {
emptyList()

Check warning on line 1086 in android/engine/src/main/java/org/smartregister/fhircore/engine/data/local/DefaultRepository.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/data/local/DefaultRepository.kt#L1086

Added line #L1086 was not covered by tests
}
} else {
searchResults.mapResourceToRepositoryResourceData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,7 @@
when {
!searchQuery.isBlank() -> {
IconButton(
onClick = {
onSearchTextChanged(SearchQuery.emptyText, performSearchOnValueChanged)
},
onClick = { onSearchTextChanged(SearchQuery.emptyText, true) },

Check warning on line 240 in android/quest/src/main/java/org/smartregister/fhircore/quest/ui/main/components/TopScreenSection.kt

View check run for this annotation

Codecov / codecov/patch

android/quest/src/main/java/org/smartregister/fhircore/quest/ui/main/components/TopScreenSection.kt#L240

Added line #L240 was not covered by tests
Copy link
Contributor

@ndegwamartin ndegwamartin Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might it be better to fix it by passing the value true from the line here?

Or even consider removing it entirely since the value true is the default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ndegwamartin We want to automatically disable search on text change for the map but enable it for the registers. This disables it for the map.

We however want to refresh the map view every time we clear data for both the register and map views hence the true. If we use performSearchOnValueChanged this is updated to false on the link you shared earlier.

modifier = modifier.testTag(TRAILING_ICON_BUTTON_TEST_TAG),
) {
Icon(
Expand Down
Loading