Skip to content

Commit df5646f

Browse files
authored
fix: use form data to check if details exist (#334)
* fix: use form data to check if details exist * docs: update CHANGELOG
1 parent 5a00b3b commit df5646f

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,15 @@ INSERT CSV ROWS IN ENGLISH ONLY
4646

4747
- TBC
4848

49-
## 1.6.0 Release candidate
49+
## 1.6.1 (TBD)
50+
51+
### Bug fixes
52+
53+
- We make sure that the automatic cleanup job only runs before deployment (instead of cron schedule cleanup).
54+
- Previously it was possible MongoDB replica set and users were left randomly uninitialised after a deployment. MongoDB initialisation container now retries on failure.
55+
- On some machines 'file' utility was not preinstalled causing provision to fail. We now install the utility if it doesn't exist.
56+
57+
## 1.6.0
5058

5159
### Breaking changes
5260

@@ -93,6 +101,7 @@ INSERT CSV ROWS IN ENGLISH ONLY
93101
5. 'PHONE_NUMBER',
94102
6. 'EMAIL'
95103
- Updated `allowedFileFormats` in signature fields to use MIME types (`image/png`, `image/jpg`, `image/jpeg`, `image/svg`) instead of simple file extensions. If you are already using the `allowedFileFormats` field in your implementation, please ensure to update the format accordingly.
104+
- The details exists conditionals for the various sections i.e. father, mother, spouse has to use the `values.detailsExist` property instead of accessing it from `draftData.[sectionName].detailsExists`. This is due to the fact that the draftData is not populated until any changes have been made to any of the fields in the current section.
96105

97106
### New features
98107

src/form/addresses/index.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
*/
1111

1212
import {
13-
FATHER_DETAILS_DONT_EXIST,
14-
MOTHER_DETAILS_DONT_EXIST,
15-
SPOUSE_DETAILS_DONT_EXIST,
1613
detailsDontExist,
1714
expressionToConditional,
1815
hideIfInformantBrideOrGroom,
@@ -99,11 +96,11 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
9996
{
10097
config: AddressSubsections.PRIMARY_ADDRESS_SUBSECTION,
10198
label: formMessageDescriptors.primaryAddress,
102-
conditionalCase: MOTHER_DETAILS_DONT_EXIST
99+
conditionalCase: detailsDontExist
103100
},
104101
{
105102
config: AddressCases.PRIMARY_ADDRESS,
106-
conditionalCase: MOTHER_DETAILS_DONT_EXIST
103+
conditionalCase: detailsDontExist
107104
} /*,
108105
{
109106
config: AddressSubsections.SECONDARY_ADDRESS_SUBSECTION,
@@ -125,9 +122,9 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
125122
config: AddressSubsections.PRIMARY_ADDRESS_SUBSECTION,
126123
label: formMessageDescriptors.primaryAddress,
127124
conditionalCase: [
128-
expressionToConditional(FATHER_DETAILS_DONT_EXIST),
125+
expressionToConditional(detailsDontExist),
129126
expressionToConditional(
130-
`${FATHER_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}`,
127+
`${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress}`,
131128
'hideInPreview'
132129
)
133130
]
@@ -149,7 +146,7 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
149146
},
150147
{
151148
config: AddressCases.PRIMARY_ADDRESS,
152-
conditionalCase: `((${FATHER_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}) && !(${mothersDetailsDontExistOnOtherPage}) || ((${detailsDontExist}) && (${mothersDetailsDontExistOnOtherPage})))`
149+
conditionalCase: `((${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress}) && !(${mothersDetailsDontExistOnOtherPage}) || ((${detailsDontExist}) && (${mothersDetailsDontExistOnOtherPage})))`
153150
} /*,
154151
{
155152
config: AddressSubsections.SECONDARY_ADDRESS_SUBSECTION,
@@ -275,9 +272,9 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
275272
config: AddressSubsections.PRIMARY_ADDRESS_SUBSECTION,
276273
label: formMessageDescriptors.primaryAddress,
277274
conditionalCase: [
278-
expressionToConditional(SPOUSE_DETAILS_DONT_EXIST),
275+
expressionToConditional(detailsDontExist),
279276
expressionToConditional(
280-
`${SPOUSE_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}`,
277+
`${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress}`,
281278
'hideInPreview'
282279
)
283280
]
@@ -297,7 +294,7 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
297294
},
298295
{
299296
config: AddressCases.PRIMARY_ADDRESS,
300-
conditionalCase: `((${SPOUSE_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}) || (${detailsDontExist}))`
297+
conditionalCase: `(${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress})`
301298
}
302299
]
303300
},

src/form/common/default-validation-conditionals.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
1010
*/
1111
import { Conditional } from '../types/types'
12-
import { IntegratingSystemType } from '../types/types'
1312
import { Validator } from '../types/validators'
1413

1514
/**
@@ -442,18 +441,11 @@ export const spouseFamilyNameConditionals = [
442441
}
443442
]
444443

445-
export const FATHER_DETAILS_DONT_EXIST =
446-
'(draftData?.father && !draftData?.father.detailsExist) || !values.detailsExist'
447-
export const MOTHER_DETAILS_DONT_EXIST =
448-
'(draftData?.mother && !draftData?.mother.detailsExist) || !values.detailsExist'
449-
export const SPOUSE_DETAILS_DONT_EXIST =
450-
'(draftData?.spouse && !draftData?.spouse.detailsExist) || !values.detailsExist'
451-
452444
// if mothers details do not exist on other page
453445
export const mothersDetailsDontExistOnOtherPage =
454446
'draftData && draftData.mother && !draftData.mother.detailsExist'
455447

456-
// if fathers details do not exist
448+
// if details don't exist for the current section
457449
export const detailsDontExist = '!values.detailsExist'
458450

459451
// primary address same as other primary

0 commit comments

Comments
 (0)