opencrvs / opencrvs-core

A global solution to civil registration
https://www.opencrvs.org
Other
90 stars 73 forks source link

Informant details are not updated properly when informant type is updated / corrected from any other option to Mother/ Father/ Spouse. #7821

Open tiri39 opened 1 month ago

tiri39 commented 1 month ago

Bug description:

Steps to reproduce:

Actual result: For birth declaration, father/ mother (the chosen informant) details are not shown in the view/ review page. For death declaration, spouse details are not shown in the view/ review page.

Expected result: For birth declaration, father/ mother (the chosen informant) details should be shown in the view/ review page. For death declaration, spouse details should be shown in the view/ review page.

Screenshot/ Recording:

For birth -

https://github.com/user-attachments/assets/59a6ec7b-7dfb-468e-b6eb-17c4c9d19f00

For death -

https://github.com/user-attachments/assets/86e2d65e-64fd-4c18-bd97-1bc02c59c058

Tested on: https://login.farajaland-qa.opencrvs.org/?lang=en

Version: v1.6.0, v1.5.1

tareq89 commented 2 weeks ago

When the informantType is changed to father, mother, or spouse, the detailsExist checkbox gets hidden (thanks to conditionals defined in the country configuration), and its value is set to true.

Now, before submitting this corrected declaration, the draftToGqlTransformer runs, and at certain points, when it comes to deciding what to do with declaration.mother.detailsExist, it calculates the conditionals for it. The following conditionals are defined for the mother.detailsExist field:

export const mothersDetailsExistConditionals = [
  {
    action: 'hide',
    expression: 'draftData?.informant?.informantType==="MOTHER"'
  },
  {
    action: 'hideInPreview',
    expression: 'values.detailsExist'
  }
];

In the transformer, if the hide conditional is found, then that field is removed from the declarations. Hence, mother.detailsExist is removed, it is submitted, and when we redownload this declaration, the detailsExist field falls back to false (as it is in the backend). As a result, the client shows that the informant data is not updated.

@rikukissa , can you suggest something? this looks like a design bug.