diff --git a/pages/results/index.tsx b/pages/results/index.tsx index a017d13a6..b234d6838 100644 --- a/pages/results/index.tsx +++ b/pages/results/index.tsx @@ -31,7 +31,7 @@ const ResultsPage = dynamic( const Results: NextPage<{ adobeAnalyticsUrl: string }> = ({ adobeAnalyticsUrl, }) => { - const [inputs, setInputs]: [ + const [_inputs, setInputs]: [ FieldInputsObject, (value: FieldInputsObject) => void ] = useSessionStorage('inputs', {}) @@ -43,7 +43,7 @@ const Results: NextPage<{ adobeAnalyticsUrl: string }> = ({ const [response, setResponse]: [any, (value: any) => void] = useSessionStorage('calculationResults', {}) - const [savedInputs, setSavedInputs]: [any, (value: any) => void] = + const [savedInputs, _setSavedInputs]: [any, (value: any) => void] = useSessionStorage('resultPageInputs', {}) const inputHelper = new InputHelper( @@ -61,6 +61,12 @@ const Results: NextPage<{ adobeAnalyticsUrl: string }> = ({ } }, []) // eslint-disable-line react-hooks/exhaustive-deps + useEffect(() => { + const mainHandler = new MainHandler(inputHelper.asObjectWithLanguage) + const response: ResponseSuccess | ResponseError = mainHandler.results + setResponse(response) + }, [language]) + return ( <> diff --git a/utils/api/helpers/utils.ts b/utils/api/helpers/utils.ts index 8b75ea2fa..af745b13a 100644 --- a/utils/api/helpers/utils.ts +++ b/utils/api/helpers/utils.ts @@ -220,6 +220,13 @@ export function OasEligibility( yearsInCanada++ } + // If client is n years + months. #219890 + // the oas should be 65 exactly not 65 plus months + age = + age > minAgeEligibility && age < minAgeEligibility + 1 + ? Math.floor(age) + : age + ageOfEligibility = yearsInCanadaAtStart < minYearsOfResEligibility ? age : Math.floor(age) @@ -269,6 +276,7 @@ export function evaluateOASInput(input) { const age = input.age // 66.42 const ageJuly2013 = calculate2013Age(age, input.clientBirthDate) const yearsInCanada = input.yearsInCanadaSince18 + let eliObj = OasEligibility( age, yearsInCanada,