Skip to content

Commit

Permalink
DBEX/97932: log started form version in show action (#19803)
Browse files Browse the repository at this point in the history
* DBEX/97932: log started form version in show action

* DBEX/97336: filter complete claims from open claims list
  • Loading branch information
aurora-a-k-a-lightning authored Dec 11, 2024
1 parent 74b0c26 commit 90d6142
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ class DisabilityCompensationInProgressFormsController < InProgressFormsControlle

def show
if form_for_user
render json: data_and_metadata_with_updated_rated_disabilities
# get IPF
data = data_and_metadata_with_updated_rated_disabilities
log_started_form_version(data, 'get IPF')
else
render json: camelized_prefill_for_user
# create IPF
data = camelized_prefill_for_user
log_started_form_version(data, 'create IPF')
end
render json: data
end

private
Expand Down Expand Up @@ -63,5 +68,27 @@ def arr_to_compare(rated_disabilities)
"#{diagnostic_code}#{rated_disability_id}#{rd['name']}"
end&.sort
end

# temp: for https://github.com/department-of-veterans-affairs/va.gov-team/issues/97932
# tracking down a possible issue with prefill
def log_started_form_version(data, location)
cloned_data = data.deep_dup
cloned_data_as_json = cloned_data.as_json.deep_transform_keys { |k| k.camelize(:lower) }

if cloned_data_as_json['formData'].present?
started_form_version = cloned_data_as_json['formData']['startedFormVersion']
message = "Form526 InProgressForm startedFormVersion = #{started_form_version} #{location}"
Rails.logger.info(message)
end

if started_form_version.blank?
raise Common::Exceptions::ServiceError.new(
detail: "no startedFormVersion detected in #{location}",
source: 'DisabilityCompensationInProgressFormsController#show'
)
end
rescue => e
Rails.logger.error("Form526 InProgressForm startedFormVersion retrieval failed #{location} #{e.message}")
end
end
end

0 comments on commit 90d6142

Please sign in to comment.