-
Notifications
You must be signed in to change notification settings - Fork 120
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
Conversation
a77bc6d
to
2f93932
Compare
@@ -470,6 +470,9 @@ def define | |||
precalculate :flat_type do | |||
flat_type | |||
end | |||
precalculate :under_green_deal do |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. 👍
fb5f235
to
bdda506
Compare
7436e6f
to
6da73db
Compare
Factcheck has been carried out and approved by Paul Heron |
6da73db
to
c4a5050
Compare
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
c4a5050
to
590fc03
Compare
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
Before

### After