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

Async process for getQuestionnairePages #2639

Open
FikriMilano opened this issue Jul 26, 2024 · 7 comments · May be fixed by #2645
Open

Async process for getQuestionnairePages #2639

FikriMilano opened this issue Jul 26, 2024 · 7 comments · May be fixed by #2645
Labels
P2 Medium priority issue type:performance

Comments

@FikriMilano
Copy link
Collaborator

FikriMilano commented Jul 26, 2024

Is your feature request related to a problem? Please describe.
getQuestionnairePages delays the UI update for ~2 seconds after changing an answer, when we have a lot of skip logic (that applies to pages).

private suspend fun getQuestionnaireState(): QuestionnaireState {
val questionnaireItemList = questionnaire.item
val questionnaireResponseItemList = questionnaireResponse.item
// Only display items on the current page while editing a paginated questionnaire, otherwise,
// display all items.
val questionnaireItemViewItems =
if (!isReadOnly && !isInReviewModeFlow.value && questionnaire.isPaginated) {
pages = getQuestionnairePages()
if (currentPageIndexFlow.value == null) {
currentPageIndexFlow.value = pages!!.first { it.enabled && !it.hidden }.index
}

Describe the solution you'd like

  1. Process the getQuestionnairePages right after changing an answer
  2. Add a progress bar on the next page, to prevent user to go to the next page until getQuestionnairePages finishes. If not, user can potentially open a blank page. The progress bar shall only be shown if the item that has it's answer changed, is going to affect pages with skip logic

Describe alternatives you've considered
Open to it

Additional context
Video of the progress bar:

Screen_recording_20240807_093625.webm
Screen_recording_20240802_145126.1.webm

Would you like to work on the issue?
Yes

@FikriMilano
Copy link
Collaborator Author

@f-odhiambo

@FikriMilano FikriMilano changed the title Asynchronous process for getQuestionnairePages Async process for getQuestionnairePages Jul 26, 2024
@santosh-pingle
Copy link
Collaborator

@FikriMilano

UI refreshing takes time after the answer is updated, and this is an issue, right?
And basically, you are making this operation asynchronous and triggering it much earlier than it used to be, right?
Also, we are showing a circular progress bar while the operation is running, which prevents the user from clicking the 'Next' button to navigate to the next page. right?

@santosh-pingle santosh-pingle added P2 Medium priority issue type:performance labels Jul 29, 2024
@FikriMilano
Copy link
Collaborator Author

@santosh-pingle Yeah! :D

@jingtang10
Copy link
Collaborator

can you share the questionnaire or ui profiling result? really curious why it takes 2 seconds

@FikriMilano
Copy link
Collaborator Author

@jingtang10 I've shared the 2 questionnaires to your email

@ellykits
Copy link
Collaborator

@FikriMilano Is the 2 seconds constant or it depends on the action being undertaken?

@FikriMilano
Copy link
Collaborator Author

Depends how many enable when expression that the questionnaire has.

In this case where it's taking 2 seconds, it's processing around ~25 enable when expressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Medium priority issue type:performance
Projects
Status: New
Development

Successfully merging a pull request may close this issue.

4 participants