-
Notifications
You must be signed in to change notification settings - Fork 0
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
CRIMAPP-1357 caseworker can add MAAT decisions #726
base: main
Are you sure you want to change the base?
Conversation
@@ -15,6 +15,7 @@ MAAT_API_OAUTH_URL='https://oauth.example.com' | |||
MAAT_API_CLIENT_ID='TestMaatApiClientID' | |||
MAAT_API_CLIENT_SECRET='TestMaatApiClientSecret' | |||
MAAT_API_API_URL='https://example.com' | |||
MAAT_API_STARTING_MAAT_ID=3 |
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.
This constant is set on a per environment basis and is used to prevent unsupported applications being retrieved.
@@ -1,6 +1,6 @@ | |||
module Deciding | |||
class Command < Dry::Struct | |||
attribute :decision_id, Types::Uuid | |||
attribute :decision_id, Types::Uuid | Types::Integer |
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.
We use the MAAT ID for the decision_id of MAAT decisions. This is used to create a unique event stream for the decision and ensure idempotency. (NB: we may start receiving notifications from MAAT relating to decisions.)
attr_reader :application_id, :decision_id, :funding_decision, :comment, | ||
:state, :reference, :maat_id, :checksum, :case_id | ||
|
||
# For decisions entered on CrimeReview by the caseworker |
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.
TYPO
class InterestsOfJusticeSet < RailsEventStore::Event; end | ||
class FundingDecisionSet < RailsEventStore::Event; end | ||
class CommentSet < RailsEventStore::Event; end | ||
class DraftCreatedFromMaat < RailsEventStore::Event; end |
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.
All of these should use Event, just don't call with build the creating events.
|
||
def call | ||
with_decision do |decision| | ||
decision.create_draft(user_id:, application_id:) | ||
decision.create_draft(user_id:, application_id:, reference:) |
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.
Including reference in all deciding events simplifies linking to streams based on reference for submission history.
def interests_of_justice | ||
return {} if @interests_of_justice.nil? | ||
return if @interests_of_justice.nil? |
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.
Review this
@@ -5,6 +5,7 @@ class Review | |||
def initialize(id) | |||
@id = id | |||
@decision_ids = [] | |||
@maat_ids = [] |
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.
remove maat_ids for now
apply DecisionAdded.build(self, user_id:, decision_id:) | ||
end | ||
|
||
def add_maat_decision(decision_id:) |
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.
Are using this?
@@ -0,0 +1,12 @@ | |||
<%= govuk_summary_list(card: { title:, actions: }, rows: rows) do |list| |
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.
Is this used?
@@ -3,71 +3,60 @@ class DecisionComponent < ViewComponent::Base | |||
include AppTextHelper | |||
include ComponentsHelper | |||
|
|||
def initialize(decision:, decision_iteration: nil, editable: false) | |||
def initialize(decision:, decision_iteration: nil, show_actions: false) |
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.
confirm show_actions consistent
@@ -10,7 +10,8 @@ def create | |||
args = { | |||
application_id: @crime_application.id, | |||
user_id: current_user_id, | |||
decision_id: decision_id | |||
decision_id: decision_id, | |||
reference: @crime_application.reference |
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.
We're recording reference in events to aid linking to submission history without having to load the aggregate.
|
||
def new | ||
@form_object = ::Decisions::MaatIdForm.new( | ||
application_id: @crime_application.id |
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.
Does this need reference?
|
||
InterestsOfJusticeDecision = Hash.schema( | ||
result: InterestsOfJusticeResult, | ||
details?: String, | ||
details?: String.optional, |
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.
Update in Schema Gem?
raise ActiveRecord::ReadonlyAttributeError, attr_name | ||
end | ||
end | ||
|
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.
☝️ prevent setting of anything other than editable prams being updated.
Description of change
Caseworker can add a MAAT decision to an application
Link to relevant ticket
Notes for reviewer
Screenshots of changes (if applicable)
Before changes:
After changes:
How to manually test the feature