fhircore icon indicating copy to clipboard operation
fhircore copied to clipboard

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

Open f-odhiambo opened this issue 1 year ago • 4 comments

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.

https://github.com/opensrp/fhir-resources/assets/61143692/a3df06a1-c429-44f4-9197-04a746177bf7

f-odhiambo avatar Jun 30 '23 11:06 f-odhiambo

@f-odhiambo this could be tied https://github.com/google/android-fhir/issues/1914

dubdabasoduba avatar Jul 04 '23 18:07 dubdabasoduba

@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

https://github.com/opensrp/fhircore/assets/84722169/d1ca73e9-5ee6-4129-b83d-53b2ab27653c

madrinekariuki avatar Sep 05 '23 06:09 madrinekariuki

@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.

Rkareko avatar Sep 07 '23 06:09 Rkareko

Current WIP PR to resolve this is linked here https://github.com/google/android-fhir/pull/2537

f-odhiambo avatar May 29 '24 13:05 f-odhiambo