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

Add callout to green deal in the energy grants calculator. #2369

Merged
merged 13 commits into from
Apr 1, 2016

Conversation

pmanrubia
Copy link
Contributor

Paired with @erikse

PT story: https://www.pivotaltracker.com/story/show/107991402
Trello card: https://trello.com/c/toqXU8S6/37-energy-grant-smart-answer-remove-green-deal-from-outcomes

On all the outcomes that fall on the under green deal we are showing a callout that informs the user that the Green Deal Home Improvement Fund is currently closed to new applications, but they are not affected if they have already applied.

We have also added the missing value to the Warm Home Discount scheme.

Factcheck

https://smart-answers-pr-2369.herokuapp.com/energy-grants-calculator/y/all_help/benefits/1954-01-01/pension_credit/before-1940/house/mains_gas,electric_heating,modern_double_glazing,loft_attic_conversion,loft_insulation,solid_wall_insulation,modern_boiler,draught_proofing

Expected changes

  • URL on gov.uk
    • Render content "The government has stopped funding the Green Deal Finance Company, which was set up to lend money to Green Deal providers. Find out how this affects you."

Before

screen shot 2016-03-29 at 14 40 00

### After

screen shot 2016-03-31 at 16 26 47

@@ -470,6 +470,9 @@ def define
precalculate :flat_type do
flat_type
end
precalculate :under_green_deal do
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this under_green_deal returns a boolean.. is there a case against not using a question mark at the end of this definition under_green_deal? For me this reads a lot more nicer.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ikennaokpala: I agree about being more readable. Unfortunately this isn't possible when using precalculate or other similar blocks. This is because the result is assigned to the state using an attribute writer derived from the block's key. In this case that would mean state.under_green_deal? = true which gives a SyntaxError. We could look at fixing this, but I think the better solution is to extract a calculator/policy object as per the refactoring docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ikennaokpala: It's probably worth adding a sentence or two to explain this in the storing data docs. I've added a Trello card to capture this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@floehopper I don't have access to /that/this Trello board

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@floehopper @erikse @ikennaokpala Happy to give a try to the calculator/policy object. It feels like a better approach. Not sure, though, if including it in this PR as we would have two different styles for precalculated values?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think a separate PR would be sensible. 👍

@pmanrubia pmanrubia force-pushed the add-callout-to-green-deal branch 3 times, most recently from fb5f235 to bdda506 Compare March 29, 2016 13:46
@ikennaokpala ikennaokpala force-pushed the add-callout-to-green-deal branch 7 times, most recently from 7436e6f to 6da73db Compare March 31, 2016 15:44
@ikennaokpala
Copy link
Contributor

Factcheck has been carried out and approved by Paul Heron

@ikennaokpala ikennaokpala force-pushed the add-callout-to-green-deal branch from 6da73db to c4a5050 Compare April 1, 2016 13:25
pmanrubia added 13 commits April 1, 2016 16:24
The same content already exists in the partial:
`title_under_green_deal.govspeak.erb`
Conditional in `outcome_bills_and_measures_on_benefits_eco_eligible`
will be reused in the `body` tag as the callout sits below the title,
and it has a different format.

It also improves readability as the logic for the rule is out
of the view.
It will be used on every outcome with a title under green deal.
Add precalculated variable `under_green_deal` to the flow which is the
inverse of the boolean condition evaluated in
`qualified_for_help_from_energy_supplier` and remove the later from
the smart answer.

Having the inverse condition allows use to use an `if` condition
in the two places it's required to render under the green deal
content in the outcome, rather than one if and one unless were
we to use `qualified_for_help_from_energy_supplier`.
Conditional in `outcome_bills_and_measures_no_benefits` will be reused
in the `body` tag as the callout sits below the title, and it has a
different format.

It also improves readability as the logic for the rule is out of the view.
Conditional in `outcome_bills_and_measures_on_benefits_not_eco_eligible`
will be reused in the `body` tag as the callout sits below the title,
and it has a different format.

It also improves readability as the logic for the rule is out of the view
@pmanrubia pmanrubia force-pushed the add-callout-to-green-deal branch from c4a5050 to 590fc03 Compare April 1, 2016 15:51
@pmanrubia pmanrubia merged commit a655901 into master Apr 1, 2016
@pmanrubia pmanrubia deleted the add-callout-to-green-deal branch April 1, 2016 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants