Skip to content

Commit

Permalink
delete notion of partner years since oas. Only care about years since 18
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-solo committed Sep 23, 2024
1 parent d421dcc commit 57477ef
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 80 deletions.
1 change: 0 additions & 1 deletion __tests__/utils/excelReaderUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ function createTransformedPayload(rowToTransform: string): Record<string, any> {
)
: undefined
: undefined,
// TODO: do the same as this but for the partner - partnerYearsInCanadaSinceOAS
yearsInCanadaSinceOAS:
transformLiveOnlyCanadaValue(
rowToTransform[
Expand Down
2 changes: 0 additions & 2 deletions components/StepperPage/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export const getSteps = (tsln) => {
'partnerLivingCountry',
'partnerLivedOnlyInCanada',
'partnerYearsInCanadaSince18',
'partnerYearsInCanadaSinceOAS',
],
buttonAttributes: {
[AA_CUSTOMCLICK]: `${AA_BUTTON_CLICK_ATTRIBUTE}:${tsln.getEstimate}`,
Expand Down Expand Up @@ -226,5 +225,4 @@ export const keyToStepMap = {
partnerLivingCountry: 4,
partnerLivedOnlyInCanada: 4,
partnerYearsInCanadaSince18: 4,
partnerYearsInCanadaSinceOAS: 4,
}
8 changes: 0 additions & 8 deletions i18n/api/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ const en: Translations = {
'Since the age of 18, has your partner only lived in Canada?',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18]:
'Since the age of 18, how many years has your partner lived in Canada?',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS]:
'How many years had your partner lived in Canada when they started receiving their Old Age Security pension?',
},
questionShortText: {
[FieldKey.AGE]: 'Age',
Expand Down Expand Up @@ -112,8 +110,6 @@ const en: Translations = {
[FieldKey.PARTNER_LIVED_ONLY_IN_CANADA]: 'Partner only lived in Canada',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18]:
'Years partner lived in Canada',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS]:
'Years partner lived in Canada',
},
questionAriaLabel: {
[FieldKey.AGE]: 'Edit your age',
Expand Down Expand Up @@ -148,8 +144,6 @@ const en: Translations = {
'Edit if your partner has only lived in Canada',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18]:
'Edit how long your partner has lived in Canada',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS]:
'Edit how long your partner has lived in Canada',
},
questionHelp: {
[FieldKey.INCOME_AVAILABLE]:
Expand All @@ -173,8 +167,6 @@ const en: Translations = {
'Only count the number of years since the age of 18.',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18]:
'Do not include periods when they were outside Canada for at least 6 months at a time. Some exceptions apply, such as working for a Canadian employer abroad.',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS]:
'Only count the number of years since the age of 18.',
},
questionOptions: {
[FieldKey.INCOME_AVAILABLE]: [
Expand Down
6 changes: 0 additions & 6 deletions i18n/api/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ const fr: Translations = {
"Depuis l'âge de 18 ans, votre conjoint a-t-il seulement vécu au Canada?",
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18]:
"Depuis l'âge de 18 ans, combien d'années votre conjoint a-t-il vécu au Canada?",
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS]:
'Votre conjoint avait vécu combien d’années au Canada lorsqu’il a commencé à recevoir sa pension de la Sécurité de la vieillesse?',
},
questionShortText: {
[FieldKey.AGE]: 'Âge',
Expand Down Expand Up @@ -116,8 +114,6 @@ const fr: Translations = {
'Conjoint a seulement vécu au Canada',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18]:
'Années où le conjoint a vécu au Canada',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS]:
'Années où le conjoint a vécu au Canada',
},
questionAriaLabel: {
[FieldKey.AGE]: 'Modifier votre âge',
Expand Down Expand Up @@ -156,8 +152,6 @@ const fr: Translations = {
'Modifier si votre conjoint a seulement vécu au Canada',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18]:
'Modifier le nombre d’années vécues au Canada de votre conjoint',
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS]:
'Modifier le nombre d’années vécues au Canada de votre conjoint',
},
questionHelp: {
[FieldKey.INCOME_AVAILABLE]:
Expand Down
7 changes: 0 additions & 7 deletions utils/api/definitions/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export enum FieldKey {
PARTNER_LEGAL_STATUS = 'partnerLegalStatus',
PARTNER_LIVED_ONLY_IN_CANADA = 'partnerLivedOnlyInCanada',
PARTNER_YEARS_IN_CANADA_SINCE_18 = 'partnerYearsInCanadaSince18',
PARTNER_YEARS_IN_CANADA_SINCE_OAS = 'partnerYearsInCanadaSinceOAS',
}

export enum FieldType {
Expand Down Expand Up @@ -181,12 +180,6 @@ export const fieldDefinitions: FieldDefinitions = {
category: { key: FieldCategory.MARITAL },
type: FieldType.NUMBER,
},
[FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS]: {
key: FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS,
// relatedKey: FieldKey.YEARS_IN_CANADA_SINCE_18,
category: { key: FieldCategory.RESIDENCE },
type: FieldType.NUMBER,
},
[FieldKey.PARTNER_BENEFIT_STATUS]: {
key: FieldKey.PARTNER_BENEFIT_STATUS,
category: { key: FieldCategory.MARITAL },
Expand Down
48 changes: 0 additions & 48 deletions utils/api/definitions/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,54 +304,6 @@ export const RequestSchema = Joi.object({
.integer()
.max(Joi.ref('partnerAge', { adjust: (age) => age - 18 }))
.message(ValidationErrors.partnerYearsSince18Empty),
partnerYearsInCanadaSinceOAS: Joi.number()
.required()
.messages({ 'any.required': ValidationErrors.partnerYearsSince18Empty })
.custom((value, helpers) => {
const { partnerAge, partnerLivingCountry, partnerYearsInCanadaSinceOAS } =
helpers.state.ancestors[0]

if (value === 0) {
return helpers.message({
custom: ValidationErrors.partnerYearsSince18Empty,
})
}

if (partnerLivingCountry === LivingCountry.CANADA) {
if (partnerYearsInCanadaSinceOAS !== undefined) {
if (partnerYearsInCanadaSinceOAS < 10) {
return helpers.message({
custom: ValidationErrors.partnerResCanadaNotEnough10,
})
} else {
if (partnerAge > 0 && partnerYearsInCanadaSinceOAS !== undefined) {
if (partnerAge - 18 < partnerYearsInCanadaSinceOAS) {
return helpers.message({
custom: ValidationErrors.partnerYearsSince18Empty,
})
}
}
}
}
} else {
if (partnerYearsInCanadaSinceOAS !== undefined) {
if (partnerYearsInCanadaSinceOAS < 20) {
return helpers.message({
custom: ValidationErrors.partnerResCanadaNotEnough20,
})
} else {
if (partnerAge > 0 && partnerYearsInCanadaSinceOAS !== undefined) {
if (partnerAge - 18 < partnerYearsInCanadaSinceOAS) {
return helpers.message({
custom: ValidationErrors.partnerYearsSince18Empty,
})
}
}
}
}
}
return value
}, 'custom validation for the "partnerYearsInCanadaSinceOAS" question'),
_language: Joi.string()
.valid(...Object.values(Language))
.default(Language.EN),
Expand Down
1 change: 0 additions & 1 deletion utils/api/definitions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export interface RequestInput {
partnerLegalStatus: LegalStatus
partnerLivedOnlyInCanada: boolean
partnerYearsInCanadaSince18: number
partnerYearsInCanadaSinceOAS?: number
_language?: Language
}

Expand Down
8 changes: 1 addition & 7 deletions utils/api/fieldsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export class FieldsHandler {
yearsInCanadaSince18: this.rawInput.partnerLivedOnlyInCanada //assume 40 when live only in Canada
? 40
: this.rawInput.partnerYearsInCanadaSince18,
yearsInCanadaSinceOAS: this.rawInput.partnerYearsInCanadaSinceOAS,
everLivedSocialCountry: false, // required by ProcessedInput
partnerBenefitStatus: new PartnerBenefitStatusHelper(
PartnerBenefitStatus.HELP_ME
Expand Down Expand Up @@ -254,12 +253,7 @@ export class FieldsHandler {

// default value = undefined
if (this.input.partner.livedOnlyInCanada === false) {
if (this.rawInput.partnerBenefitStatus === 'oasGis') {
console.log('should push the partner years in canada since oas')
requiredFields.push(FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_OAS)
} else {
requiredFields.push(FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18)
}
requiredFields.push(FieldKey.PARTNER_YEARS_IN_CANADA_SINCE_18)
}

/*
Expand Down

0 comments on commit 57477ef

Please sign in to comment.