alphagov/EFG — pull request #207 by Sidane (2014-03-17 12:04:18+00:00)
Title: Phase 6 Changes

**Pull request contains `state-aid-refactor` at the moment.**
You can diff just the [changes in this branch](https://github.com/alphagov/EFG/compare/state-aid-refactor...phase-6).

EFG Phase 6 has a number of policy changes, the biggest of which is a new State Aid Calculation. The calculation is now de-coupled from the Premium Schedule as it no longer depends on the total premiums value.

Other Phase 6 changes relate to:

* a new Euro conversion rate
* new loan term and loan amount constraints
* max amount is £1.2M when loan term is <= 5 years
* max amount is £600k when loan term is > 5 years
* an extended maximum loan term for Type E loans (36 months instead of 24)

Code changes of note:

* `Phase` is now a static association
* Euro conversation rate is now stored on `Phase`
* Old euro conversion rate values from `PremiumSchedule` are now stored on the corresponding `Loan` record
* `Phase5Rules` and `Phase6Rules` define specific constraints and validations for Loans in those Phases
* `Phase5Rules` applies to all pre-Phase 6 loans
* ActiveModel custom validators have been introduced to make it easier to validate Phase specific rules
* `EligibilityCheck` has been removed in favour of using custom validators

UI changes:

* At Phase 6 Loan Entry the `Calculate State Aid` button now redirects back to the Loan Entry form, with the state aid value populated. For Phase 5, this button still redirects to the `Generate Premium Schedule` page.
* For Phase 6 loans, a Premium Schedule can be generated at any time from `incomplete` onwards, but must be generated before Loan Offer.
* Miscellaneous text changes here and there.