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

[OpenSRP 2] The cursor constantly moves to the beginning of the word/number when one tries to fill details in the registration form #2512

Closed
f-odhiambo opened this issue Jun 30, 2023 · 4 comments
Labels
Bug Report Something isn't working as expected

Comments

@f-odhiambo
Copy link
Contributor

Describe the bug
The cursor constantly moves to the beginning of the word/number when one tries to fill details in the registration form.

To Reproduce
Steps to reproduce the behavior:

  1. Login to the app
  2. Click on Add new Patient in the Drawer
  3. In the registration form; observe the cursor when you are filling in the details of any field.

RESULTS:
When one is filling in the details of any field; the the cursor constantly moves to the beginning of the word/number. This causes inaccuracies in filling the correct details. One has to also select the end of the word/ number to continue typing.

Expected behavior
The cursor should always be at the end of the last thing typed unless selected otherwise.

XRecorder_24052023_114936.mp4
@f-odhiambo f-odhiambo added Bug Report Something isn't working as expected OpenSRP 2 labels Jun 30, 2023
@dubdabasoduba
Copy link
Member

dubdabasoduba commented Jul 4, 2023

@f-odhiambo this could be tied google/android-fhir#1914

@pld pld removed the OpenSRP 2 label Aug 7, 2023
@Rkareko Rkareko self-assigned this Sep 4, 2023
@madrinekariuki
Copy link

madrinekariuki commented Sep 5, 2023

@Rkareko
Device: G60android 9&& Samsung A12 android 11
apk: https://github.com/opensrp/fhircore/releases/tag/v1.0.0-opensrp-rc2

See below video under Quantity restocked in the stock inventory page while trying to restock a commodity.
for ECBIS this seems to only impact the Quantity restock

20230905-095108.mp4

@Rkareko
Copy link
Contributor

Rkareko commented Sep 7, 2023

@f-odhiambo @dubdabasoduba After investigation it seems that the issue of the cursor moving to the beginning when typing in the Quantity Restocked field can be traced to the calculated-expression for the Pending stock adjustment quantity question.

{
      "extension": [
        {
          "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",
          "valueExpression": {
            "language": "text/fhirpath",
            "expression": "iif(((%resource.descendants().where(linkId='4571fa5f-8448-4e69-8395-c1962154e39c').answer.value + %resource.descendants().where(linkId='cc3a573f-8faf-49bd-8649-c74fcd31ab7e').answer.value + %resource.descendants().where(linkId='a71d3a65-9f08-4316-8ebf-41c376a4932e').answer.value) - %resource.descendants().where(linkId='d2cda03f-dc14-4f15-85ab-d5c33027aa31').answer.value) < 0, ((%resource.descendants().where(linkId='4571fa5f-8448-4e69-8395-c1962154e39c').answer.value + %resource.descendants().where(linkId='cc3a573f-8faf-49bd-8649-c74fcd31ab7e').answer.value + %resource.descendants().where(linkId='a71d3a65-9f08-4316-8ebf-41c376a4932e').answer.value) - %resource.descendants().where(linkId='d2cda03f-dc14-4f15-85ab-d5c33027aa31').answer.value).toString().replaceMatches('-', '').toInteger(), ((%resource.descendants().where(linkId='4571fa5f-8448-4e69-8395-c1962154e39c').answer.value + %resource.descendants().where(linkId='cc3a573f-8faf-49bd-8649-c74fcd31ab7e').answer.value + %resource.descendants().where(linkId='a71d3a65-9f08-4316-8ebf-41c376a4932e').answer.value) - %resource.descendants().where(linkId='d2cda03f-dc14-4f15-85ab-d5c33027aa31').answer.value)) - (iif(%resource.descendants().where(linkId='fa6c4894-1c7b-47fd-b4b2-18b2d45fa0cc').answer.value.exists(), %resource.descendants().where(linkId='fa6c4894-1c7b-47fd-b4b2-18b2d45fa0cc').answer.value, 0) + iif(%resource.descendants().where(linkId='66e1ca2e-a46a-42e2-c397-a12c30b8525e').answer.value.exists(), %resource.descendants().where(linkId='66e1ca2e-a46a-42e2-c397-a12c30b8525e').answer.value, 0) + iif(%resource.descendants().where(linkId='8e4e1945-667b-4096-cdc9-5780377a4b89').answer.value.exists(), %resource.descendants().where(linkId='8e4e1945-667b-4096-cdc9-5780377a4b89').answer.value, 0) + iif(%resource.descendants().where(linkId='be137683-fda1-4fe3-86e7-39bbd3c87299').answer.value.exists(), %resource.descendants().where(linkId='be137683-fda1-4fe3-86e7-39bbd3c87299').answer.value, 0) + iif(%resource.descendants().where(linkId='605f0de5-3d7e-4e3d-977b-b05932602d9e').answer.value.exists(), %resource.descendants().where(linkId='605f0de5-3d7e-4e3d-977b-b05932602d9e').answer.value, 0))"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/maxValue",
          "valueInteger": 0
        }
      ],
      "linkId": "ff0821a9-29ce-4fbf-8498-c6668fd36594",
      "text": "Pending stock adjustment quantity",
      "type": "integer",
      "required": true,
      "enableWhen": [
        {
          "question": "634264d1-2ffd-4aac-cc13-87466f6702b3",
          "operator": "!=",
          "answerInteger": 0
        }
      ],
      "readOnly": true
    }

The defiition for the Quantity Restocked can be found below

    {
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/minValue",
          "valueInteger": 0
        }
      ],
      "linkId": "35f0cdc3-7c3f-4a7a-8299-62fd801b9510",
      "text": "Quantity Restocked",
      "type": "integer",
      "required": true,
      "initial": [
        {
          "valueInteger": 0
        }
      ]
    }

As can be seen the Quantity Restocked field is not part of the items used in the calculated-expression above. The interesting thing is that when the Quantity Restocked linkId is added to the calculated-expression the bug does not occur.

@f-odhiambo
Copy link
Contributor Author

Current WIP PR to resolve this is linked here google/android-fhir#2537

@f-odhiambo f-odhiambo removed their assignment Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

5 participants