ministryofjustice / laa-apply-for-legal-aid

The laa-apply-for-legal-aid system is a web service by use for solicitors providing legal aid services to enter applications for legal aid on-line. It asks for details of applicant means (income and assets), and the merits of a case, and gives a decision on whether legal aid can be granted or not, and if so, will push the application through to back-end processes for payment.
https://apply-for-legal-aid.service.justice.gov.uk/
MIT License
17 stars 7 forks source link

AP-5143: initiate state machine after create #7435

Closed jsugarman closed 4 days ago

jsugarman commented 4 days ago

What

Initiate state machine after application creation

Link to story

With the removal of this hook an inadvertent side effect has been removed

  after_create do
    ActiveSupport::Notifications.instrument "dashboard.application_created", id:, state:
  end

The calling of the state method in this code means it actually calls state_machine_proxy method, which creates a state_machine relation on the application if it does not have one. Its removal therefore opens up issues both in tests and possibly functioning of the app.

By replacing it with an explicit call to state_machine_proxy we avoid the issue.

Checklist

Before you ask people to review this PR:

sonarcloud[bot] commented 4 days ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud