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

CRIMAPP-1597 store overall_result type rather than string #805

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

timpeat
Copy link
Member

@timpeat timpeat commented Jan 31, 2025

Description of change

Store the overall result as a type.

Link to relevant ticket

CRIMAPP-1597

Notes for reviewer

The initial plan was to store MAAT strings directly in the datastore overall_result, as MAAT is the source of truth for decisions and its logic is complex. However, testing has shown that these strings do not fully meet providers' needs and may cause confusion.

Instead, we will store a constant representing the overall result, which clients can translate into text as needed. This result will combine the funding_decision with any relevant qualifications that help providers understand the next steps.

The overall result is now displayed to the user in the format funding_decision - qualification, e.g., "Granted - with contribution" or "Refused - failed IoJ". In the datastore, these values are stored as types, such as granted_with_contribution and refused_failed_ioj.

Screenshots of changes (if applicable)

Before changes:

After changes:

How to manually test the feature

@timpeat timpeat force-pushed the CRIMAPP-1597-feature-toggle-overall-result branch from 1975aa8 to 6068377 Compare January 31, 2025 17:32
@timpeat timpeat changed the title Store overall result as a constant CRIMAPP-1597 store overall_result type rather than string Jan 31, 2025
@timpeat timpeat force-pushed the CRIMAPP-1597-feature-toggle-overall-result branch from 6068377 to 0d43b60 Compare February 3, 2025 09:09
@timpeat timpeat force-pushed the CRIMAPP-1597-feature-toggle-overall-result branch from 0d43b60 to f7503ef Compare February 3, 2025 09:47
'GRANTED'
when /refused/
'FAILIOJ'
decision.set_funding_decision(user_id:, funding_decision:)
end
Copy link
Member Author

Choose a reason for hiding this comment

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

☝️ removes redundant code. The overall result is now calculated in the same way across all application types.

def initialize(decision)
@decision = decision
end

Copy link
Member Author

Choose a reason for hiding this comment

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

The overall result is now displayed to the user in the format funding_decision - qualification, e.g., "Granted - with contribution" or "Refused - failed IoJ".

In the datastore, these values are stored as types, such as granted_with_contribution and refused_failed_ioj.

This class determines the OverallResult type.

@timpeat timpeat marked this pull request as ready for review February 3, 2025 10:01
@timpeat timpeat requested a review from a team as a code owner February 3, 2025 10:01
Copy link
Contributor

@EdwinKruglov EdwinKruglov left a comment

Choose a reason for hiding this comment

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

Looks good 👍 Just one small thing I've left a comment about.

@@ -14,17 +14,17 @@

context 'when funding is "granted"' do
let(:funding_decision) { 'granted' }
let(:overall_result) { 'Granted - Passed Means Test' }
let(:overall_result) { Types::OverallResult['granted_with_contribution'] }

it { is_expected.to have_text('Granted') }
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we expect the text to be "Granted - with contribution"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great catch, thank you! I have fixed string and added exact: true option to the matcher.

@timpeat timpeat merged commit c77fa8a into main Feb 3, 2025
7 checks passed
@timpeat timpeat deleted the CRIMAPP-1597-feature-toggle-overall-result branch February 3, 2025 11:34
Copy link

sentry-io bot commented Feb 4, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ ActionView::Template::Error: "granted_on_ioj" violates constraints (included_in?(["granted", "granted_with_contribution", "gra... Casework::CrimeApplicationsController#show View Issue

Did you find this useful? React with a 👍 or 👎

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.

2 participants