From 9a164dfa687515d2f06b111f2df667a433655078 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:26:29 +0000 Subject: [PATCH 1/2] Export dates as iso8601 (#2871) --- app/services/exports/organisation_export_service.rb | 6 ++++-- app/services/exports/user_export_service.rb | 1 + spec/fixtures/exports/user.xml | 2 +- spec/services/exports/organisation_export_service_spec.rb | 2 +- spec/services/exports/user_export_service_spec.rb | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/services/exports/organisation_export_service.rb b/app/services/exports/organisation_export_service.rb index 2b2da71c8..afcf16cb0 100644 --- a/app/services/exports/organisation_export_service.rb +++ b/app/services/exports/organisation_export_service.rb @@ -56,11 +56,13 @@ module Exports def apply_cds_transformation(organisation) attribute_hash = organisation.attributes - attribute_hash["deleted_at"] = organisation.discarded_at + attribute_hash["deleted_at"] = organisation.discarded_at&.iso8601 attribute_hash["dsa_signed"] = organisation.data_protection_confirmed? - attribute_hash["dsa_signed_at"] = organisation.data_protection_confirmation&.signed_at + attribute_hash["dsa_signed_at"] = organisation.data_protection_confirmation&.signed_at&.iso8601 attribute_hash["dpo_email"] = organisation.data_protection_confirmation&.data_protection_officer_email attribute_hash["provider_type"] = organisation.provider_type_before_type_cast + attribute_hash["merge_date"] = organisation.merge_date&.iso8601 + attribute_hash["available_from"] = organisation.available_from&.iso8601 attribute_hash["profit_status"] = nil # will need update when we add the field to the org attribute_hash["group"] = nil # will need update when we add the field to the org diff --git a/app/services/exports/user_export_service.rb b/app/services/exports/user_export_service.rb index aaa30c424..707d13c14 100644 --- a/app/services/exports/user_export_service.rb +++ b/app/services/exports/user_export_service.rb @@ -60,6 +60,7 @@ module Exports attribute_hash["organisation_name"] = user.organisation.name attribute_hash["active"] = user.active? attribute_hash["phone"] = [user.phone, user.phone_extension].compact.join(" ") + attribute_hash["last_sign_in_at"] = user.last_sign_in_at&.iso8601 attribute_hash end end diff --git a/spec/fixtures/exports/user.xml b/spec/fixtures/exports/user.xml index d29a33225..4c5286c68 100644 --- a/spec/fixtures/exports/user.xml +++ b/spec/fixtures/exports/user.xml @@ -6,7 +6,7 @@ Danny Rojas {organisation_id} 5 - + 2022-03-03T00:00:00+00:00 data_provider 1234512345123 123 false diff --git a/spec/services/exports/organisation_export_service_spec.rb b/spec/services/exports/organisation_export_service_spec.rb index 51c8fe8cf..199ee239e 100644 --- a/spec/services/exports/organisation_export_service_spec.rb +++ b/spec/services/exports/organisation_export_service_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Exports::OrganisationExportService do def replace_entity_ids(organisation, export_template) export_template.sub!(/\{id\}/, organisation["id"].to_s) export_template.sub!(/\{name\}/, organisation["name"]) - export_template.sub!(/\{dsa_signed_at\}/, organisation.data_protection_confirmation&.signed_at.to_s) + export_template.sub!(/\{dsa_signed_at\}/, organisation.data_protection_confirmation&.signed_at&.iso8601) export_template.sub!(/\{dpo_email\}/, organisation.data_protection_confirmation&.data_protection_officer_email) end diff --git a/spec/services/exports/user_export_service_spec.rb b/spec/services/exports/user_export_service_spec.rb index 854dd1ce7..3f4ece76d 100644 --- a/spec/services/exports/user_export_service_spec.rb +++ b/spec/services/exports/user_export_service_spec.rb @@ -43,7 +43,7 @@ RSpec.describe Exports::UserExportService do end context "and one user is available for export" do - let!(:user) { create(:user, organisation:, name: "Danny Rojas", phone_extension: "123") } + let!(:user) { create(:user, organisation:, name: "Danny Rojas", phone_extension: "123", last_sign_in_at: Time.zone.local(2022, 3, 3)) } it "generates a ZIP export file with the expected filename" do expect(storage_service).to receive(:write_file).with(expected_zip_filename, any_args) From 5e0f3ebbb4f16ff575767c572ed09a30b3fb64af Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:26:51 +0000 Subject: [PATCH 2/2] update mini profiler (#2872) --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 98479cd34..033706b39 100644 --- a/Gemfile +++ b/Gemfile @@ -90,7 +90,7 @@ group :development do # Display performance information such as SQL time and flame graphs for each request in your browser. # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md gem "erb_lint", require: false - gem "rack-mini-profiler", "~> 2.0" + gem "rack-mini-profiler", "~> 3.3.0" gem "rubocop-govuk", "4.3.0", require: false gem "rubocop-performance", require: false gem "rubocop-rails", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 8a678576c..5017836a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -340,7 +340,7 @@ GEM rack (3.1.8) rack-attack (6.7.0) rack (>= 1.0, < 4) - rack-mini-profiler (2.3.4) + rack-mini-profiler (3.3.1) rack (>= 1.2.0) rack-session (2.0.0) rack (>= 3.0.0) @@ -581,7 +581,7 @@ DEPENDENCIES pundit rack (>= 2.2.6.3) rack-attack - rack-mini-profiler (~> 2.0) + rack-mini-profiler (~> 3.3.0) rails (~> 7.2.2) rails_admin (~> 3.1) redcarpet (~> 3.6)