Skip to content

Commit

Permalink
[CRIMAPP-1485] Set missing attributes (#1249)
Browse files Browse the repository at this point in the history
Set missing attributes
  • Loading branch information
hiboabd authored Nov 13, 2024
1 parent 648c89e commit 4ae24de
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/controllers/developer_tools/crime_applications_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# :nocov:
module DeveloperTools
class CrimeApplicationsController < ApplicationController
class CrimeApplicationsController < ApplicationController # rubocop:disable Metrics/ClassLength
def destroy
current_crime_application.destroy

Expand All @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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 = {})
Expand Down

0 comments on commit 4ae24de

Please sign in to comment.