From 4ae24de9b9bfce179263aec662fa4f329099b74d Mon Sep 17 00:00:00 2001 From: Hibo <51047911+hiboabd@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:23:57 +0000 Subject: [PATCH] [CRIMAPP-1485] Set missing attributes (#1249) Set missing attributes --- .../crime_applications_controller.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/developer_tools/crime_applications_controller.rb b/app/controllers/developer_tools/crime_applications_controller.rb index ac049a50c..e381c651d 100644 --- a/app/controllers/developer_tools/crime_applications_controller.rb +++ b/app/controllers/developer_tools/crime_applications_controller.rb @@ -1,6 +1,6 @@ # :nocov: module DeveloperTools - class CrimeApplicationsController < ApplicationController + class CrimeApplicationsController < ApplicationController # rubocop:disable Metrics/ClassLength def destroy current_crime_application.destroy @@ -26,9 +26,11 @@ def mark_as_returned # rubocop:disable Metrics/MethodLength, Metrics/AbcSize def bypass_dwp find_or_create_applicant + find_or_create_case find_or_create_partner_detail crime_application.update( + is_means_tested: 'yes', navigation_stack: [ edit_steps_client_details_path(crime_application), edit_steps_client_is_means_tested_path(crime_application), @@ -63,6 +65,7 @@ def under18_bypass find_or_create_case crime_application.update( + is_means_tested: 'yes', navigation_stack: [ edit_steps_client_details_path(crime_application), edit_steps_client_is_means_tested_path(crime_application), @@ -103,8 +106,12 @@ def find_or_create_applicant(overrides = {}) # rubocop:disable Metrics/MethodLen end end - def find_or_create_case - Case.find_or_initialize_by(crime_application_id: crime_application.id) + def find_or_create_case(overrides = {}) + Case.find_or_initialize_by(crime_application_id: crime_application.id).tap do |record| + record.update( + case_type: overrides.fetch(:case_type, 'summary_only'), + ) + end end def find_or_create_partner_detail(overrides = {})