Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix state pension topup 2017 birthday bug #2909

Merged
merged 4 commits into from
Feb 14, 2017

Conversation

leenagupte
Copy link
Contributor

@leenagupte leenagupte commented Feb 8, 2017

Trello card: https://trello.com/c/M542k4eW

Motivation

The state pension popup calculator is supposed to show you how large of a lump sum payment you need to make to popup your weekly pension.

This lump sum changes depending on how old you are. So, you would pay smaller lump sum when you are 70 years old than when you are 69.

The potential lump sums displayed to the user, shows them a list of payments they can make at each age.

e.g.

£18,450 when you’re 72
£17,975 when you’re 73

The code to generate this churns out one payment amount per calendar year. This seemed ok because you only have one birthday a year, and could therefore only make one payment.

There was a problem with this though. The final year of the scheme, 2017, only runs from 1st January to 5th April. If you birthday is after 6th April, everything is fine. You can only make a payment based on your current age.

However, if your birthday happens to fall between these 3 months, you could potentially make a lower lump sum payment on or after your next birthday.

The calculator did not handle this last scenario.

I’ve added an ugly hack to get around this problem. The calculator is being retired in 2 months, so it doesn’t seem worth the effort to come up with a more elegant solution.

Factcheck

state-pension-topup

Expected changes

Before

screen shot 2017-02-08 at 11 48 04

After

screen shot 2017-02-08 at 11 48 35

@leenagupte leenagupte added bug Something isn't working Don't merge needs content review Waiting for a content designer to approve and removed Don't merge labels Feb 8, 2017
@leenagupte leenagupte changed the title [Do not merge] State pension topup/2017 birthday bug State pension topup/2017 birthday bug Feb 8, 2017
@leenagupte leenagupte changed the title State pension topup/2017 birthday bug Fix state pension topup 2017 birthday bug Feb 8, 2017
@leenagupte leenagupte force-pushed the state-pension-topup/2017-birthday-bug branch from 766b95d to cd7373c Compare February 8, 2017 16:12
Copy link
Contributor

@ikennaokpala ikennaokpala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leenagupte is there a reason for adding the if age >= retirement_age(gender) guard.?? it appears redundant

@leenagupte
Copy link
Contributor Author

@ikennaokpala I copied the line to append a row from the loop directly above it. As it's a short-term hack I didn't put any thought into what the guard is needed for.

@pmanrubia
Copy link
Contributor

Agree with @ikennaokpala's point, but we are going to retire this Smart Answer in a few weeks... let's move to fact-check.

Copy link
Contributor

@pmanrubia pmanrubia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved as this is going to be retired in a few weeks, and it seems to fix an existing bug.

@leenagupte leenagupte added Passed code review and removed needs content review Waiting for a content designer to approve Ready for code review labels Feb 10, 2017
@leenagupte leenagupte force-pushed the state-pension-topup/2017-birthday-bug branch from 9de0009 to d549481 Compare February 13, 2017 16:52
This pull request is trying to replicate and fix a bug that occurs if
your birthday falls in the last 3 months of the scheme. 

Updating the current time for the regression tests allows us to baseline
regression test content with what is currently on the live system.

Future commits should see this content change.
The state pension popup calculator is supposed to show you how large
of a lump sum payment you need to make to popup your weekly pension.

This lump sum changes depending on how old you are. So, you would pay
smaller lump sum when you are 70 years old than when you are 69.

The potential lump sums displayed to the user, shows them a list of
payments they can make at each age.

e.g.

£18,450 when you’re 72
£17,975 when you’re 73

The code to generate this churns out one payment amount per calendar
year. This seemed ok because you only have one birthday a year, and
could therefore only make one payment.

There was a problem with this though. The final year of the scheme, 2017,
only runs from 1st January to 5th April. If you birthday is after 6th
April, everything is fine. You can only make a payment based on your
current age.

However, if your birthday happens to fall between these 3 months, you
could potentially make a lower lump sum payment on or after your next
birthday.

The calculator did not handle this last scenario.

I’ve added an ugly hack to get around this problem. The calculator is
being retired in 2 months, so it doesn’t seem worth the effort to come
up with a more elegant solution.
The test artefacts are updated as expected.
@leenagupte leenagupte force-pushed the state-pension-topup/2017-birthday-bug branch from d549481 to 3d0de3b Compare February 13, 2017 17:08
The state-pension-topup calculator should only show one topup age if the user
doesn't have any more birthdays before the scheme ends.

The original loop to get the number of birthdays, works out how old you are going
to turn in a calendar year.

For the final year of the scheme, this needs to be amended to be how old you are
going to turn in the first 3 months of the year, and if you have a birthday in
the first 3 months, it should take into account whether your birthday has already
passed or not.

That wasn't happening with the previous hack. If your birthday is between 1st
January and 5th April it was showing two ages, regardless of whether you'd already
celebrated your birthday.
@leenagupte leenagupte force-pushed the state-pension-topup/2017-birthday-bug branch from 3d0de3b to bfb8908 Compare February 14, 2017 13:32
@leenagupte leenagupte merged commit 930b5b6 into master Feb 14, 2017
@leenagupte leenagupte deleted the state-pension-topup/2017-birthday-bug branch February 14, 2017 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants