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

Previous button shows up on the first page #2568

Open
LZRS opened this issue Jun 12, 2024 · 0 comments · May be fixed by #2569
Open

Previous button shows up on the first page #2568

LZRS opened this issue Jun 12, 2024 · 0 comments · May be fixed by #2569
Assignees
Labels
effort:xsmall Extra small effort - 1 day P3 Low priority issue

Comments

@LZRS
Copy link
Collaborator

LZRS commented Jun 12, 2024

Describe the bug
Sometimes the "previous" button used for paginations shows in the first page, and crashes with the following exception when clicked

org...rtregister.fhircore.mwcoreDev  E  FATAL EXCEPTION: main
                                                                                                    Process: org.smartregister.fhircore.mwcoreDev, PID: 16413
                                                                                                    java.lang.IllegalStateException: Can't call goToPreviousPage() if no preceding page is enabled
                                                                                                    	at com.google.android.fhir.datacapture.QuestionnaireViewModel.goToPreviousPage$datacapture_release(QuestionnaireViewModel.kt:483)
                                                                                                    	at com.google.android.fhir.datacapture.QuestionnaireFragment.onViewCreated$lambda$1(QuestionnaireFragment.kt:98)
                                                                                                    	at com.google.android.fhir.datacapture.QuestionnaireFragment.$r8$lambda$Uy3n-EtWjyq7ZdNYJNMoLcmE2DA(Unknown Source:0)
                                                                                                    	at com.google.android.fhir.datacapture.QuestionnaireFragment$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
                                                                                                    	at android.view.View.performClick(View.java:7448)
                                                                                                    	at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1218)
                                                                                                    	at android.view.View.performClickInternal(View.java:7425)
                                                                                                    	at android.view.View.access$3600(View.java:810)
                                                                                                    	at android.view.View$PerformClick.run(View.java:28305)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:938)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loop(Looper.java:223)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7656)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Component
SDC library

Expected behavior
Previous button shouldn't show up on the first page

Screenshots

Additional context
It seems to happen when the questionnaire has items (in our case, hidden) not marked with extension for page, coming before ones with page

...

  "item": [
    {
      "linkId": "just-hidden",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden",
          "valueBoolean": true
        }
      ],
      "type": "boolean",
      "initial": [
        {
          "valueBoolean": true
        }
      ]
    },
    {
      "linkId": "PR",
      "type": "group",
      "text": "Client info",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "http://hl7.org/fhir/questionnaire-item-control",
                "code": "page",
                "display": "Page"
              }
            ]
          }
        }
      ],

....

example.json

Would you like to work on the issue?
Yes

@LZRS LZRS linked a pull request Jun 12, 2024 that will close this issue
7 tasks
@MJ1998 MJ1998 added P3 Low priority issue effort:xsmall Extra small effort - 1 day labels Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:xsmall Extra small effort - 1 day P3 Low priority issue
Projects
Status: New
Development

Successfully merging a pull request may close this issue.

2 participants