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

Fix Locations not showing on register. #3457

Merged
merged 6 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -1067,7 +1067,7 @@
// TODO This will require a new config model for related entity location filter
val locationIds =
syncLocationIds
.map { retrieveSubLocations(it).map { subLocation -> subLocation.logicalId } }
.map { retrieveFlattenedSubLocations(it).map { subLocation -> subLocation.logicalId } }

Check warning on line 1070 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#L1070

Added line #L1070 was not covered by tests
.flatten()
.plus(syncLocationIds)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@
applicationConfiguration.usePractitionerAssignedLocationOnSync ||
runBlocking { syncLocationIdsProtoStore.data.firstOrNull() }?.isNotEmpty() == true
) {
triggerSync()
schedulePeriodicSync()

Check warning on line 164 in android/quest/src/main/java/org/smartregister/fhircore/quest/ui/main/AppMainActivity.kt

View check run for this annotation

Codecov / codecov/patch

android/quest/src/main/java/org/smartregister/fhircore/quest/ui/main/AppMainActivity.kt#L164

Added line #L164 was not covered by tests
}
} else {
triggerSync()
schedulePeriodicSync()

Check warning on line 167 in android/quest/src/main/java/org/smartregister/fhircore/quest/ui/main/AppMainActivity.kt

View check run for this annotation

Codecov / codecov/patch

android/quest/src/main/java/org/smartregister/fhircore/quest/ui/main/AppMainActivity.kt#L167

Added line #L167 was not covered by tests
}
} else {
showToast(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ constructor(
}
}

fun triggerSync() {
fun schedulePeriodicSync() {
viewModelScope.launch {
syncBroadcaster.schedulePeriodicSync(applicationConfiguration.syncInterval)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.viewModelScope
import androidx.navigation.fragment.navArgs
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import dagger.hilt.android.AndroidEntryPoint
Expand Down Expand Up @@ -59,7 +60,8 @@
multiSelectViewModel.saveSelectedLocations(requireContext())
appMainViewModel.run {
if (requireContext().isDeviceOnline()) {
triggerSync()
viewModelScope.launch { syncBroadcaster.runOneTimeSync() }
schedulePeriodicSync()

Check warning on line 64 in android/quest/src/main/java/org/smartregister/fhircore/quest/ui/multiselect/MultiSelectBottomSheetFragment.kt

View check run for this annotation

Codecov / codecov/patch

android/quest/src/main/java/org/smartregister/fhircore/quest/ui/multiselect/MultiSelectBottomSheetFragment.kt#L63-L64

Added lines #L63 - L64 were not covered by tests
} else {
requireContext()
.showToast(
Expand Down
Loading