Skip to content

Commit

Permalink
Merge branch 'update-details-exists-conditionals' of github.com:openc…
Browse files Browse the repository at this point in the history
…rvs/opencrvs-countryconfig into test-changed-conditionals
  • Loading branch information
Zangetsu101 committed Dec 3, 2024
2 parents 75de9a4 + 5a83b8f commit 13cf45c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion infrastructure/docker-compose.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ services:
- jwt-public-key.{{ts}}
environment:
- NODE_ENV=production
- MONGO_URL=mongodb://events:${METRICS_MONGODB_PASSWORD}@mongo1/events?replicaSet=rs0
- MONGO_URL=mongodb://events:${EVENTS_MONGODB_PASSWORD}@mongo1/events?replicaSet=rs0
deploy:
labels:
- 'traefik.enable=false'
Expand Down
19 changes: 8 additions & 11 deletions src/form/addresses/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*/

import {
FATHER_DETAILS_DONT_EXIST,
MOTHER_DETAILS_DONT_EXIST,
SPOUSE_DETAILS_DONT_EXIST,
detailsDontExist,
expressionToConditional,
hideIfInformantBrideOrGroom,
Expand Down Expand Up @@ -101,11 +98,11 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
{
config: AddressSubsections.PRIMARY_ADDRESS_SUBSECTION,
label: formMessageDescriptors.primaryAddress,
conditionalCase: MOTHER_DETAILS_DONT_EXIST
conditionalCase: detailsDontExist
},
{
config: AddressCases.PRIMARY_ADDRESS,
conditionalCase: MOTHER_DETAILS_DONT_EXIST
conditionalCase: detailsDontExist
} /*,
{
config: AddressSubsections.SECONDARY_ADDRESS_SUBSECTION,
Expand All @@ -128,10 +125,10 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
label: formMessageDescriptors.primaryAddress,
conditionalCase: [
expressionToConditional(
`${FATHER_DETAILS_DONT_EXIST} || ${hideIfMotherAddressNotAvailable[0].expression}`
`${detailsDontExist} || ${hideIfMotherAddressNotAvailable[0].expression}`
),
expressionToConditional(
`${FATHER_DETAILS_DONT_EXIST} || ${hideIfMotherAddressNotAvailable[0].expression} || ${primaryAddressSameAsOtherPrimaryAddress}`,
`${detailsDontExist} || ${hideIfMotherAddressNotAvailable[0].expression} || ${primaryAddressSameAsOtherPrimaryAddress}`,
'hideInPreview'
)
]
Expand All @@ -153,7 +150,7 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
},
{
config: AddressCases.PRIMARY_ADDRESS,
conditionalCase: `((${FATHER_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}) && !(${mothersDetailsDontExistOnOtherPage}) || ((${detailsDontExist}) && (${mothersDetailsDontExistOnOtherPage})))`
conditionalCase: `((${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress}) && !(${mothersDetailsDontExistOnOtherPage}) || ((${detailsDontExist}) && (${mothersDetailsDontExistOnOtherPage})))`
} /*,
{
config: AddressSubsections.SECONDARY_ADDRESS_SUBSECTION,
Expand Down Expand Up @@ -282,10 +279,10 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
label: formMessageDescriptors.primaryAddress,
conditionalCase: [
expressionToConditional(
`${SPOUSE_DETAILS_DONT_EXIST} || ${hideIfDeceasedAddressNotAvailable[0].expression}`
`${detailsDontExist} || ${hideIfDeceasedAddressNotAvailable[0].expression}`
),
expressionToConditional(
`${SPOUSE_DETAILS_DONT_EXIST} || ${hideIfDeceasedAddressNotAvailable[0].expression} || ${primaryAddressSameAsOtherPrimaryAddress}`,
`${detailsDontExist} || ${hideIfDeceasedAddressNotAvailable[0].expression} || ${primaryAddressSameAsOtherPrimaryAddress}`,
'hideInPreview'
)
]
Expand All @@ -307,7 +304,7 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [
},
{
config: AddressCases.PRIMARY_ADDRESS,
conditionalCase: `((${SPOUSE_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}) || (${detailsDontExist}))`
conditionalCase: `(${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress})`
}
]
},
Expand Down
10 changes: 1 addition & 9 deletions src/form/common/default-validation-conditionals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/
import { Conditional } from '../types/types'
import { IntegratingSystemType } from '../types/types'
import { Validator } from '../types/validators'

/**
Expand Down Expand Up @@ -456,18 +455,11 @@ export const spouseFamilyNameConditionals = [
}
]

export const FATHER_DETAILS_DONT_EXIST =
'(draftData?.father && !draftData?.father.detailsExist) || !values.detailsExist'
export const MOTHER_DETAILS_DONT_EXIST =
'(draftData?.mother && !draftData?.mother.detailsExist) || !values.detailsExist'
export const SPOUSE_DETAILS_DONT_EXIST =
'(draftData?.spouse && !draftData?.spouse.detailsExist) || !values.detailsExist'

// if mothers details do not exist on other page
export const mothersDetailsDontExistOnOtherPage =
'draftData && draftData.mother && !draftData.mother.detailsExist'

// if fathers details do not exist
// if details don't exist for the current section
export const detailsDontExist = '!values.detailsExist'

// primary address same as other primary
Expand Down

0 comments on commit 13cf45c

Please sign in to comment.