Skip to content

Commit

Permalink
Show case number from MAAT
Browse files Browse the repository at this point in the history
Display the case number for a representation order taken from MAAT. As this is
experimental it can be enabled or disabled by the user.
  • Loading branch information
jrmhaig committed Apr 11, 2024
1 parent 69583da commit f596c60
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 136 deletions.
269 changes: 135 additions & 134 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1000`
# on 2024-03-04 09:59:46 UTC using RuboCop version 1.61.0.
# on 2024-04-03 07:52:00 UTC using RuboCop version 1.62.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -16,6 +16,137 @@ FactoryBot/FactoryAssociationWithStrategy:
- 'spec/factories/claim/transfer_details.rb'
- 'spec/factories/expenses.rb'

# Offense count: 670
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Exclude:
- 'spec/api/entities/base_fee_type_spec.rb'
- 'spec/api/entities/case_stage_spec.rb'
- 'spec/api/entities/case_worker_spec.rb'
- 'spec/api/entities/cclf/adapted_warrant_fee_spec.rb'
- 'spec/api/entities/cclf/case_type_spec.rb'
- 'spec/api/entities/ccr/adapted_hardship_fee_spec.rb'
- 'spec/api/entities/ccr/adapted_warrant_fee_spec.rb'
- 'spec/api/entities/ccr/defendant_spec.rb'
- 'spec/api/entities/ccr/representation_order_spec.rb'
- 'spec/api/entities/defendant_spec.rb'
- 'spec/api/entities/disbursement_spec.rb'
- 'spec/api/entities/expense_spec.rb'
- 'spec/api/entities/expense_type_spec.rb'
- 'spec/api/entities/fee_spec.rb'
- 'spec/api/entities/injection_attempt_spec.rb'
- 'spec/api/entities/search_result_spec.rb'
- 'spec/api/error_response_spec.rb'
- 'spec/api/v1/dropdown_data_spec.rb'
- 'spec/api/v1/external_users/claims/integration/advocate_claim_creation_spec.rb'
- 'spec/api/v1/external_users/claims/integration/litigator_claim_creation_spec.rb'
- 'spec/api/v1/external_users/defendant_spec.rb'
- 'spec/api/v1/external_users/disbursement_spec.rb'
- 'spec/api/v1/external_users/expense_spec.rb'
- 'spec/api/v1/external_users/fee_spec.rb'
- 'spec/api/v1/external_users/representation_order_spec.rb'
- 'spec/api/v2/case_workers/claim_spec.rb'
- 'spec/api/v2/cclf_claim_spec.rb'
- 'spec/api/v2/ccr_claim_spec.rb'
- 'spec/api/v2/mi/additional_information_expenses_spec.rb'
- 'spec/api/v2/mi/agfs_scheme_ten_claims_spec.rb'
- 'spec/api/v2/mi/injection_errors_spec.rb'
- 'spec/controllers/case_conclusions_controller_spec.rb'
- 'spec/controllers/case_workers/admin/allocations_controller_spec.rb'
- 'spec/controllers/case_workers/admin/case_workers_controller_spec.rb'
- 'spec/controllers/case_workers/claims_controller_spec.rb'
- 'spec/controllers/external_users/admin/external_users_controller_spec.rb'
- 'spec/controllers/external_users/advocates/claims_controller_spec.rb'
- 'spec/controllers/external_users/advocates/interim_claims_controller_spec.rb'
- 'spec/controllers/external_users/certifications_controller_spec.rb'
- 'spec/controllers/external_users/litigators/claims_controller_spec.rb'
- 'spec/controllers/external_users/litigators/transfer_claims_controller_spec.rb'
- 'spec/controllers/provider_management/providers_controller_spec.rb'
- 'spec/controllers/super_admins/admin/super_admins_controller_spec.rb'
- 'spec/controllers/vat_rates_controller_spec.rb'
- 'spec/factories/case_workers.rb'
- 'spec/factories/certification_types.rb'
- 'spec/factories/defendants.rb'
- 'spec/factories/external_users.rb'
- 'spec/factories/messages.rb'
- 'spec/factories/super_admins.rb'
- 'spec/fixtures/ccr/test_expenses.rb'
- 'spec/form_builders/adp_form_builder_spec.rb'
- 'spec/form_builders/adp_text_field_spec.rb'
- 'spec/helpers/case_workers/claims_helper_spec.rb'
- 'spec/helpers/case_workers/travel_helper_spec.rb'
- 'spec/helpers/claims_helper_spec.rb'
- 'spec/lib/data_migrator/offence_code_generator_spec.rb'
- 'spec/lib/extensions/xml_mini_extension_spec.rb'
- 'spec/lib/govuk_component/button_helpers_spec.rb'
- 'spec/lib/govuk_component/link_helpers_spec.rb'
- 'spec/lib/govuk_component/panel_helpers_spec.rb'
- 'spec/lib/govuk_component/warning_text_helpers_spec.rb'
- 'spec/mailers/devise_mailer_spec.rb'
- 'spec/mailers/notify_mailer_spec.rb'
- 'spec/models/assessment_spec.rb'
- 'spec/models/case_stage_spec.rb'
- 'spec/models/certification_type_spec.rb'
- 'spec/models/claim/transfer_brain_spec.rb'
- 'spec/models/claim/transfer_detail_spec.rb'
- 'spec/models/claim_spec.rb'
- 'spec/models/claims/cloner_spec.rb'
- 'spec/models/claims/financial_summary_spec.rb'
- 'spec/models/claims/search_spec.rb'
- 'spec/models/claims/state_machine_scopes_spec.rb'
- 'spec/models/disbursement_type_spec.rb'
- 'spec/models/document_spec.rb'
- 'spec/models/expense_spec.rb'
- 'spec/models/expense_type_spec.rb'
- 'spec/models/fee/base_fee_type_spec.rb'
- 'spec/models/fee/basic_fee_spec.rb'
- 'spec/models/google_analytics/ga_data_adapter_spec.rb'
- 'spec/models/google_analytics/gtm_data_adapter_spec.rb'
- 'spec/models/location_spec.rb'
- 'spec/models/message_spec.rb'
- 'spec/models/provider_spec.rb'
- 'spec/models/stats/stats_report_spec.rb'
- 'spec/models/timed_transitions/transitioner_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/presenters/claim_state_transition_presenter_spec.rb'
- 'spec/presenters/determination_presenter_spec.rb'
- 'spec/presenters/error_message/presenter_spec.rb'
- 'spec/presenters/expense_presenter_spec.rb'
- 'spec/presenters/expense_type_presenter_spec.rb'
- 'spec/presenters/fee/base_fee_presenter_spec.rb'
- 'spec/presenters/fee/interim_fee_presenter_spec.rb'
- 'spec/presenters/fee/interim_fee_type_presenter_spec.rb'
- 'spec/services/ccr/daily_attendance_adapter_spec.rb'
- 'spec/services/ccr/fee/misc_fee_adapter_spec.rb'
- 'spec/services/claims/case_worker_claim_updater_spec.rb'
- 'spec/services/claims/fee_calculator/bill_scenario_spec.rb'
- 'spec/services/claims/fee_calculator/exceptions_spec.rb'
- 'spec/services/claims/fee_calculator/fee_type_mappings_spec.rb'
- 'spec/services/claims/fee_calculator/modifier_decorator_spec.rb'
- 'spec/services/claims/fee_calculator/price_spec.rb'
- 'spec/services/claims/fee_calculator/request_spec.rb'
- 'spec/services/claims/fee_calculator/unit_price_spec.rb'
- 'spec/services/claims/update_claim_spec.rb'
- 'spec/services/fee_reform/search_offences_spec.rb'
- 'spec/services/injection_response_service_spec.rb'
- 'spec/services/message_queue/aws_client_spec.rb'
- 'spec/services/remote/injection_attempt_spec.rb'
- 'spec/support/seed_helpers.rb'
- 'spec/support/shared_examples_for_claim_types.rb'
- 'spec/support/shared_examples_for_fee_adapters.rb'
- 'spec/support/transfer_brain_helpers.rb'
- 'spec/validators/claim/advocate_supplementary_claim_validator_spec.rb'
- 'spec/validators/claim/base_claim_validator_spec.rb'
- 'spec/validators/claim/shared_examples_for_advocate_litigator.rb'
- 'spec/validators/claim/shared_examples_for_step_validators.rb'
- 'spec/validators/claim/transfer_claim_validator_spec.rb'
- 'spec/validators/date_attended_validator_spec.rb'
- 'spec/validators/defendant_validator_spec.rb'
- 'spec/validators/representation_order_validator_spec.rb'
- 'spec/views/case_workers/claims/show_spec.rb'

# Offense count: 65
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Expand Down Expand Up @@ -116,10 +247,11 @@ Metrics/AbcSize:
- 'spec/support/seed_helpers.rb'
- 'spec/support/validation_helpers.rb'

# Offense count: 20
# Offense count: 21
# Configuration parameters: CountComments, Max, CountAsOne.
Metrics/ClassLength:
Exclude:
- 'app/controllers/case_workers/claims_controller.rb'
- 'app/controllers/external_users/claims_controller.rb'
- 'app/form_builders/adp_text_field.rb'
- 'app/interfaces/api/entities/search_result.rb'
Expand Down Expand Up @@ -964,7 +1096,7 @@ RSpec/MultipleDescribes:
- 'spec/models/claim/base_claim_spec.rb'
- 'spec/routing/claims_controller_spec.rb'

# Offense count: 638
# Offense count: 637
# Configuration parameters: Max.
RSpec/MultipleExpectations:
Exclude:
Expand Down Expand Up @@ -1906,134 +2038,3 @@ Style/RescueModifier:
Style/RescueStandardError:
Exclude:
- 'spec/factories/claim/base_claims.rb'

# Offense count: 669
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Exclude:
- 'spec/api/entities/base_fee_type_spec.rb'
- 'spec/api/entities/case_stage_spec.rb'
- 'spec/api/entities/case_worker_spec.rb'
- 'spec/api/entities/cclf/adapted_warrant_fee_spec.rb'
- 'spec/api/entities/cclf/case_type_spec.rb'
- 'spec/api/entities/ccr/adapted_hardship_fee_spec.rb'
- 'spec/api/entities/ccr/adapted_warrant_fee_spec.rb'
- 'spec/api/entities/ccr/defendant_spec.rb'
- 'spec/api/entities/ccr/representation_order_spec.rb'
- 'spec/api/entities/defendant_spec.rb'
- 'spec/api/entities/disbursement_spec.rb'
- 'spec/api/entities/expense_spec.rb'
- 'spec/api/entities/expense_type_spec.rb'
- 'spec/api/entities/fee_spec.rb'
- 'spec/api/entities/injection_attempt_spec.rb'
- 'spec/api/entities/search_result_spec.rb'
- 'spec/api/error_response_spec.rb'
- 'spec/api/v1/dropdown_data_spec.rb'
- 'spec/api/v1/external_users/claims/integration/advocate_claim_creation_spec.rb'
- 'spec/api/v1/external_users/claims/integration/litigator_claim_creation_spec.rb'
- 'spec/api/v1/external_users/defendant_spec.rb'
- 'spec/api/v1/external_users/disbursement_spec.rb'
- 'spec/api/v1/external_users/expense_spec.rb'
- 'spec/api/v1/external_users/fee_spec.rb'
- 'spec/api/v1/external_users/representation_order_spec.rb'
- 'spec/api/v2/case_workers/claim_spec.rb'
- 'spec/api/v2/cclf_claim_spec.rb'
- 'spec/api/v2/ccr_claim_spec.rb'
- 'spec/api/v2/mi/additional_information_expenses_spec.rb'
- 'spec/api/v2/mi/agfs_scheme_ten_claims_spec.rb'
- 'spec/api/v2/mi/injection_errors_spec.rb'
- 'spec/controllers/case_conclusions_controller_spec.rb'
- 'spec/controllers/case_workers/admin/allocations_controller_spec.rb'
- 'spec/controllers/case_workers/admin/case_workers_controller_spec.rb'
- 'spec/controllers/case_workers/claims_controller_spec.rb'
- 'spec/controllers/external_users/admin/external_users_controller_spec.rb'
- 'spec/controllers/external_users/advocates/claims_controller_spec.rb'
- 'spec/controllers/external_users/advocates/interim_claims_controller_spec.rb'
- 'spec/controllers/external_users/certifications_controller_spec.rb'
- 'spec/controllers/external_users/litigators/claims_controller_spec.rb'
- 'spec/controllers/external_users/litigators/transfer_claims_controller_spec.rb'
- 'spec/controllers/provider_management/providers_controller_spec.rb'
- 'spec/controllers/super_admins/admin/super_admins_controller_spec.rb'
- 'spec/controllers/vat_rates_controller_spec.rb'
- 'spec/factories/case_workers.rb'
- 'spec/factories/certification_types.rb'
- 'spec/factories/defendants.rb'
- 'spec/factories/external_users.rb'
- 'spec/factories/messages.rb'
- 'spec/factories/super_admins.rb'
- 'spec/fixtures/ccr/test_expenses.rb'
- 'spec/form_builders/adp_form_builder_spec.rb'
- 'spec/form_builders/adp_text_field_spec.rb'
- 'spec/helpers/case_workers/claims_helper_spec.rb'
- 'spec/helpers/case_workers/travel_helper_spec.rb'
- 'spec/helpers/claims_helper_spec.rb'
- 'spec/lib/data_migrator/offence_code_generator_spec.rb'
- 'spec/lib/extensions/xml_mini_extension_spec.rb'
- 'spec/lib/govuk_component/button_helpers_spec.rb'
- 'spec/lib/govuk_component/link_helpers_spec.rb'
- 'spec/lib/govuk_component/panel_helpers_spec.rb'
- 'spec/lib/govuk_component/warning_text_helpers_spec.rb'
- 'spec/mailers/devise_mailer_spec.rb'
- 'spec/mailers/notify_mailer_spec.rb'
- 'spec/models/assessment_spec.rb'
- 'spec/models/case_stage_spec.rb'
- 'spec/models/certification_type_spec.rb'
- 'spec/models/claim/transfer_brain_spec.rb'
- 'spec/models/claim/transfer_detail_spec.rb'
- 'spec/models/claim_spec.rb'
- 'spec/models/claims/cloner_spec.rb'
- 'spec/models/claims/financial_summary_spec.rb'
- 'spec/models/claims/search_spec.rb'
- 'spec/models/claims/state_machine_scopes_spec.rb'
- 'spec/models/disbursement_type_spec.rb'
- 'spec/models/document_spec.rb'
- 'spec/models/expense_spec.rb'
- 'spec/models/expense_type_spec.rb'
- 'spec/models/fee/base_fee_type_spec.rb'
- 'spec/models/fee/basic_fee_spec.rb'
- 'spec/models/google_analytics/ga_data_adapter_spec.rb'
- 'spec/models/google_analytics/gtm_data_adapter_spec.rb'
- 'spec/models/location_spec.rb'
- 'spec/models/message_spec.rb'
- 'spec/models/provider_spec.rb'
- 'spec/models/stats/stats_report_spec.rb'
- 'spec/models/timed_transitions/transitioner_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/presenters/claim_state_transition_presenter_spec.rb'
- 'spec/presenters/determination_presenter_spec.rb'
- 'spec/presenters/error_message/presenter_spec.rb'
- 'spec/presenters/expense_presenter_spec.rb'
- 'spec/presenters/expense_type_presenter_spec.rb'
- 'spec/presenters/fee/base_fee_presenter_spec.rb'
- 'spec/presenters/fee/interim_fee_presenter_spec.rb'
- 'spec/presenters/fee/interim_fee_type_presenter_spec.rb'
- 'spec/services/ccr/daily_attendance_adapter_spec.rb'
- 'spec/services/ccr/fee/misc_fee_adapter_spec.rb'
- 'spec/services/claims/case_worker_claim_updater_spec.rb'
- 'spec/services/claims/fee_calculator/bill_scenario_spec.rb'
- 'spec/services/claims/fee_calculator/exceptions_spec.rb'
- 'spec/services/claims/fee_calculator/fee_type_mappings_spec.rb'
- 'spec/services/claims/fee_calculator/modifier_decorator_spec.rb'
- 'spec/services/claims/fee_calculator/price_spec.rb'
- 'spec/services/claims/fee_calculator/request_spec.rb'
- 'spec/services/claims/fee_calculator/unit_price_spec.rb'
- 'spec/services/claims/update_claim_spec.rb'
- 'spec/services/fee_reform/search_offences_spec.rb'
- 'spec/services/injection_response_service_spec.rb'
- 'spec/services/message_queue/aws_client_spec.rb'
- 'spec/services/remote/injection_attempt_spec.rb'
- 'spec/support/seed_helpers.rb'
- 'spec/support/shared_examples_for_claim_types.rb'
- 'spec/support/shared_examples_for_fee_adapters.rb'
- 'spec/support/transfer_brain_helpers.rb'
- 'spec/validators/claim/advocate_supplementary_claim_validator_spec.rb'
- 'spec/validators/claim/base_claim_validator_spec.rb'
- 'spec/validators/claim/shared_examples_for_advocate_litigator.rb'
- 'spec/validators/claim/shared_examples_for_step_validators.rb'
- 'spec/validators/claim/transfer_claim_validator_spec.rb'
- 'spec/validators/date_attended_validator_spec.rb'
- 'spec/validators/defendant_validator_spec.rb'
- 'spec/validators/representation_order_validator_spec.rb'
- 'spec/views/case_workers/claims/show_spec.rb'
10 changes: 10 additions & 0 deletions app/controllers/case_workers/claims_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ClaimsController < CaseWorkers::ApplicationController
before_action :filter_archived_claims, only: [:archived]
before_action :sort_claims, only: %i[index archived]
before_action :set_claim, only: %i[show messages download_zip]
before_action :set_show_maat_details

include ReadMessages
include MessageControlsDisplay
Expand Down Expand Up @@ -131,5 +132,14 @@ def sort_claims
def criteria_params
{ sorting: sort_column, direction: sort_direction, page: current_page, limit: page_size, search: search_terms }
end

def set_show_maat_details
if params[:maat_details].present?
@show_maat_details = params[:maat_details] == 'on'
current_user.save_setting!(maat_details: @show_maat_details)
else
@show_maat_details = current_user.setting?(:maat_details) || false
end
end
end
end
7 changes: 6 additions & 1 deletion app/views/shared/_claim.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@
%h3.govuk-heading-m
= t('.defendants')

= render partial: 'shared/claim_defendants', locals: {defendants: claim.defendants }
- if @show_maat_details
= govuk_link_to t('.disable_maat_details'), '?maat_details=off'
= render partial: 'shared/claim_defendants_with_maat', locals: {defendants: claim.defendants }
- else
= govuk_link_to t('.enable_maat_details'), '?maat_details=on'
= render partial: 'shared/claim_defendants', locals: {defendants: claim.defendants }

- else
.govuk-grid-row
Expand Down
37 changes: 37 additions & 0 deletions app/views/shared/_claim_defendant_details_with_maat.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.app-card--defendant
%h4.govuk-heading-s
= t('.defendant', context: index)

= govuk_summary_list do
= govuk_summary_list_row_collection( t('external_users.claims.defendants.defendant_fields.full_name') ) { defendant.name }

- if defendant.date_of_birth.present?
= govuk_summary_list_row_collection( t('external_users.claims.defendants.defendant_fields.date_of_birth') ) { defendant.date_of_birth.strftime(Settings.date_format) rescue '' }

- unless @claim.lgfs? && @claim.interim?
= govuk_summary_list_row_collection( t('external_users.claims.defendants.defendant_fields.judical_apportionment') ) { defendant.order_for_judicial_apportionment == true ? t('global_yes') : t('global_no') }


- if defendant.representation_orders.any?
= govuk_table do
= govuk_table_caption do
= t('shared.claim.reporders')

= govuk_table_thead_collection [t('.date'),
t('external_users.claims.defendants.representation_order_fields.maat_reference_number'),
t('.case_number_from_maat')]

= govuk_table_tbody do
- defendant.representation_orders.each do | representation_order |
= govuk_table_row do
= govuk_table_td('data-label': t('.date')) do
= representation_order.representation_order_date.strftime(Settings.date_format) rescue ''

= govuk_table_td('data-label': t('external_users.claims.defendants.representation_order_fields.maat_reference_number')) do
= representation_order.maat_reference

= govuk_table_td('data-label': t('.case_number_from_maat')) do
= representation_order.maat_details[:case_number]

- else
= govuk_inset_text(t('.no_reporder'))
2 changes: 1 addition & 1 deletion app/views/shared/_claim_defendants.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- defendants.each_with_index do | defendant, index |
.govuk-grid-column-one-half
= render partial: 'shared/claim_defendant_details', locals: { defendant: present(defendant, CaseWorkers::DefendantPresenter), index: index += 1 }
= render partial: 'shared/claim_defendant_details', locals: { defendant:, index: index += 1 }
3 changes: 3 additions & 0 deletions app/views/shared/_claim_defendants_with_maat.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- defendants.each_with_index do | defendant, index |
.govuk-grid-column-one-half
= render partial: 'shared/claim_defendant_details_with_maat', locals: { defendant: present(defendant, CaseWorkers::DefendantPresenter), index: index += 1 }
Loading

0 comments on commit f596c60

Please sign in to comment.