Skip to content

Conversation

anandwana001
Copy link
Collaborator

@auto-assign auto-assign bot requested a review from sufyanAbbasi August 12, 2025 01:29
@gino-m
Copy link
Collaborator

gino-m commented Sep 9, 2025

@anandwana001 Gentle ping

@gino-m gino-m removed the request for review from sufyanAbbasi September 9, 2025 20:15
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

❌ Patch coverage is 70.37037% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.22%. Comparing base (225b1fa) to head (45eb096).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...droid/ui/datacollection/DataCollectionViewModel.kt 75.43% 4 Missing and 10 partials ⚠️
...ndroid/ui/datacollection/DataCollectionFragment.kt 59.09% 6 Missing and 3 partials ⚠️
...undplatform/android/ui/datacollection/LoadState.kt 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3224      +/-   ##
============================================
+ Coverage     67.16%   67.22%   +0.05%     
- Complexity     1411     1415       +4     
============================================
  Files           303      304       +1     
  Lines          7642     7682      +40     
  Branches        774      782       +8     
============================================
+ Hits           5133     5164      +31     
- Misses         2076     2080       +4     
- Partials        433      438       +5     
Files with missing lines Coverage Δ
...undplatform/android/ui/datacollection/LoadState.kt 50.00% <50.00%> (ø)
...ndroid/ui/datacollection/DataCollectionFragment.kt 66.05% <59.09%> (-1.66%) ⬇️
...droid/ui/datacollection/DataCollectionViewModel.kt 76.84% <75.43%> (+0.47%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shobhitagarwal1612
Copy link
Member

Use cases to verify:

  1. Opening the data collection flow with a small survey
  2. Opening the data collection flow with a very large survey (or by adding some delay in the load logic)
  3. Resuming the data collection flow with a small/large survey
  4. Resume on start task, mid task and end task
  5. Screen orientation changes

viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
var uiStateJob: Job? = null
viewModel.loadState.collect { state ->
binding.progressBar.isVisible = state is LoadState.Loading
Copy link
Member

Choose a reason for hiding this comment

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

Ensure that this is well tested too.

Comment on lines +107 to +124
when (state) {
is LoadState.Error -> {
uiStateJob?.cancel()
}

lifecycleScope.launch { viewModel.uiState.filterNotNull().collect { updateUI(it) } }
is LoadState.Ready -> {
updateUI(
UiState.TaskListAvailable(
state.tasks,
viewModel.getTaskPosition(viewModel.getCurrentTaskId()),
)
)
uiStateJob?.cancel()
uiStateJob = launch { viewModel.uiState.filterNotNull().collect { updateUI(it) } }
}
else -> {
uiStateJob?.cancel()
}
Copy link
Member

Choose a reason for hiding this comment

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

Please refactor this code into smaller (single-purpose) functions for better readability.

throw e
}
}
val surveyId: String
Copy link
Member

Choose a reason for hiding this comment

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

Please check if this can be kept private

viewModelFactory.create(getViewModelClass(task.type))
} catch (e: Exception) {
Timber.e("ignoring task with invalid type: $task.type")
Timber.e("$e ignoring task with invalid type: $task.type")
Copy link
Member

Choose a reason for hiding this comment

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

Log the entire throwable instead of adding it to the message.

import org.groundplatform.android.model.job.Job
import org.groundplatform.android.model.task.Task

sealed interface LoadState {
Copy link
Member

Choose a reason for hiding this comment

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

Suggestions:

  1. Please rename it to be more generic (something like UiState?)
  2. Consider adding more states to this interface (e.g. collecting data, data submitted) along with validations

runner()
.validateTextIsDisplayed("Unnamed point")
.validateTextIsDisplayed(requireNotNull(JOB.name))
runner().validateTextIsDisplayed(TASK_1_NAME).validateTextIsDisplayed(requireNotNull(JOB.name))
Copy link
Member

Choose a reason for hiding this comment

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

Please verify why this change was required? Does this indicate a regression?

@anandwana001
Copy link
Collaborator Author

Continuing in #3261

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.

[Trending crash] TimeoutKt.TimeoutCancellationException
3 participants