From bc5695cca73338bfd34b04ef249443c65b17f2ea Mon Sep 17 00:00:00 2001 From: Jack S Date: Tue, 13 Jun 2023 08:05:46 +0100 Subject: [PATCH] Address code review --- app/helpers/data_sharing_agreement_helper.rb | 2 +- app/models/log.rb | 4 ++-- app/views/organisations/data_sharing_agreement.html.erb | 2 +- db/seeds.rb | 8 ++++---- spec/shared/shared_log_examples.rb | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/helpers/data_sharing_agreement_helper.rb b/app/helpers/data_sharing_agreement_helper.rb index 278ad722f..e79819ffb 100644 --- a/app/helpers/data_sharing_agreement_helper.rb +++ b/app/helpers/data_sharing_agreement_helper.rb @@ -40,7 +40,7 @@ module DataSharingAgreementHelper end # rubocop:disable Rails/HelperInstanceVariable - def section_12_2(data_protection_confirmation:, user:, organisation:) + def present_section_12_2(data_protection_confirmation:, user:, organisation:) if data_protection_confirmation&.confirmed? @org_address = data_protection_confirmation.organisation.address_row @org_name = data_protection_confirmation.organisation.name diff --git a/app/models/log.rb b/app/models/log.rb index 6b4c4b324..452aa67c6 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -9,7 +9,7 @@ class Log < ApplicationRecord belongs_to :bulk_upload, optional: true before_save :update_status! - before_validation :verify_dsa_signed, on: :create + before_validation :verify_data_protection_confirmation, on: :create STATUS = { "not_started" => 0, @@ -178,7 +178,7 @@ class Log < ApplicationRecord private - def verify_dsa_signed + def verify_data_protection_confirmation return unless FeatureToggle.new_data_protection_confirmation? return unless owning_organisation return if owning_organisation.data_protection_confirmed? diff --git a/app/views/organisations/data_sharing_agreement.html.erb b/app/views/organisations/data_sharing_agreement.html.erb index 02da03f53..f60d64b7c 100644 --- a/app/views/organisations/data_sharing_agreement.html.erb +++ b/app/views/organisations/data_sharing_agreement.html.erb @@ -106,7 +106,7 @@

12. Authorised representatives

12.1. CORE data providers and DLUHC will each appoint an Authorised Representative to be the primary point of contact in all day-to-day matters relating to this Agreement:

- <%= section_12_2(data_protection_confirmation: @data_protection_confirmation, user: current_user, organisation: @organisation) %> + <%= present_section_12_2(data_protection_confirmation: @data_protection_confirmation, user: current_user, organisation: @organisation) %>

12.3. For DLUHC: Name: Rachel Worledge, Postal Address: South-west section, 4th Floor, Fry Building, 2 Marsham Street, London, SW1P 4DF, diff --git a/db/seeds.rb b/db/seeds.rb index 77b84f968..7a45dd063 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,7 +7,7 @@ # Character.create(name: 'Luke', movie: movies.first) # rubocop:disable Rails/Output -def create_dsa(user) +def create_data_protection_confirmation(user) DataProtectionConfirmation.find_or_create_by!( organisation: user.organisation, confirmed: true, @@ -94,7 +94,7 @@ unless Rails.env.test? ) do |user| user.password = "password" user.confirmed_at = Time.zone.now - create_dsa(user) + create_data_protection_confirmation(user) end User.find_or_create_by!( @@ -105,7 +105,7 @@ unless Rails.env.test? ) do |user| user.password = "password" user.confirmed_at = Time.zone.now - create_dsa(user) + create_data_protection_confirmation(user) end standalone_no_stock = Organisation.find_or_create_by!( @@ -187,7 +187,7 @@ unless Rails.env.test? user.confirmed_at = Time.zone.now end - create_dsa(support_user) + create_data_protection_confirmation(support_user) pp "Seeded 3 dummy users" end diff --git a/spec/shared/shared_log_examples.rb b/spec/shared/shared_log_examples.rb index ccc893387..1a2629ba2 100644 --- a/spec/shared/shared_log_examples.rb +++ b/spec/shared/shared_log_examples.rb @@ -105,7 +105,7 @@ RSpec.shared_examples "shared log examples" do |log_type| end end - describe "#verify_dsa_signed" do + describe "#verify_data_protection_confirmation" do before do allow(FeatureToggle).to receive(:new_data_protection_confirmation?).and_return(false) end