Class: V0::DisabilityCompensationInProgressFormsController
- Inherits:
-
InProgressFormsController
- Object
- ActionController::API
- ApplicationController
- InProgressFormsController
- V0::DisabilityCompensationInProgressFormsController
- Defined in:
- app/controllers/v0/disability_compensation_in_progress_forms_controller.rb
Constant Summary
Constants inherited from ApplicationController
ApplicationController::VERSION_STATUS
Constants included from SignIn::Authentication
SignIn::Authentication::BEARER_PATTERN
Constants included from ExceptionHandling
ExceptionHandling::SKIP_SENTRY_EXCEPTION_TYPES
Instance Attribute Summary
Attributes inherited from ApplicationController
Instance Method Summary collapse
- #arr_to_compare(rated_disabilities) ⇒ Object private
- #data_and_metadata_with_updated_rated_disabilities ⇒ Object private
- #form_id ⇒ Object private
- #rated_disabilities_evss ⇒ Object private
- #show ⇒ Object
Methods inherited from InProgressFormsController
#camelize_with_olivebranch, #camelized_prefill_for_user, #destroy, #form_for_user, #index, #update
Methods included from IgnoreNotFound
Methods inherited from ApplicationController
#clear_saved_form, #cors_preflight, #pagination_params, #render_job_id, #routing_error, #set_csrf_header
Methods included from Traceable
Methods included from SentryControllerLogging
#set_tags_and_extra_context, #tags_context, #user_context
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Methods included from Instrumentation
Methods included from SignIn::Authentication
#access_token, #access_token_authenticate, #authenticate, #authenticate_access_token, #bearer_token, #cookie_access_token, #handle_authenticate_error, #load_user, #load_user_object, #scrub_bearer_token, #validate_request_ip
Methods included from Headers
Methods included from ExceptionHandling
#render_errors, #report_mapped_exception, #report_original_exception, #skip_sentry_exception?, #skip_sentry_exception_types
Methods included from AuthenticationAndSSOConcerns
#authenticate, #clear_session, #extend_session!, #load_user, #log_sso_info, #render_unauthorized, #reset_session, #set_api_cookie!, #set_current_user, #set_session_expiration_header, #set_session_object, #sign_in_service_exp_time, #sign_in_service_session, #sso_cookie_content, #sso_logging_info, #validate_inbound_login_params, #validate_session
Methods included from SignIn::AudienceValidator
#authenticate, #validate_audience!
Instance Method Details
#arr_to_compare(rated_disabilities) ⇒ Object (private)
59 60 61 62 63 64 65 |
# File 'app/controllers/v0/disability_compensation_in_progress_forms_controller.rb', line 59 def arr_to_compare(rated_disabilities) rated_disabilities&.collect do |rd| diagnostic_code = rd['diagnostic_code'] || rd['diagnosticCode'] rated_disability_id = rd['rated_disability_id'] || rd['ratedDisabilityId'] "#{diagnostic_code}#{rated_disability_id}#{rd['name']}" end&.sort end |
#data_and_metadata_with_updated_rated_disabilities ⇒ Object (private)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/v0/disability_compensation_in_progress_forms_controller.rb', line 21 def parsed_form_data = JSON.parse(form_for_user.form_data) = form_for_user. # If EVSS's list of rated disabilities does not match our prefilled rated disabilities if rated_disabilities_evss.present? && arr_to_compare(parsed_form_data['ratedDisabilities']) != arr_to_compare(rated_disabilities_evss.rated_disabilities) if parsed_form_data['ratedDisabilities'].present? && parsed_form_data.dig('view:claimType', 'view:claimingIncrease') ['returnUrl'] = '/disabilities/rated-disabilities' end evss_rated_disabilities = JSON.parse(rated_disabilities_evss.rated_disabilities.to_json) parsed_form_data['updatedRatedDisabilities'] = camelize_with_olivebranch(evss_rated_disabilities) end # for Toxic Exposure 1.1 - add indicator to In Progress Forms # moving forward, we don't want to change the version if it is already there if Flipper.enabled?(:disability_526_toxic_exposure_ipf, @current_user) && parsed_form_data['startedFormVersion'].blank? parsed_form_data['startedFormVersion'] = '2019' end { formData: parsed_form_data, metadata: } end |
#form_id ⇒ Object (private)
17 18 19 |
# File 'app/controllers/v0/disability_compensation_in_progress_forms_controller.rb', line 17 def form_id FormProfiles::VA526ez::FORM_ID end |
#rated_disabilities_evss ⇒ Object (private)
51 52 53 54 55 56 57 |
# File 'app/controllers/v0/disability_compensation_in_progress_forms_controller.rb', line 51 def rated_disabilities_evss @rated_disabilities_evss ||= FormProfiles::VA526ez.for(form_id:, user: @current_user) .initialize_rated_disabilities_information rescue # if the call to EVSS fails we can skip updating. EVSS fails around an hour each night. nil end |
#show ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/controllers/v0/disability_compensation_in_progress_forms_controller.rb', line 7 def show if form_for_user render json: else render json: camelized_prefill_for_user end end |