Browse Source

Update paper_trail, add missing translations, lint

pull/2856/head
Kat 6 months ago
parent
commit
d32b9cea92
  1. 2
      Gemfile
  2. 6
      Gemfile.lock
  3. 16
      app/models/scheme.rb
  4. 4
      config/locales/en.yml
  5. 2
      db/migrate/20241206142943_create_active_storage_variant_records.active_storage.rb
  6. 4
      db/seeds.rb

2
Gemfile

@ -44,7 +44,7 @@ gem "view_component", "~> 3.9"
# Use the AWS S3 SDK as storage mechanism # Use the AWS S3 SDK as storage mechanism
gem "aws-sdk-s3" gem "aws-sdk-s3"
# Track changes to models for auditing or versioning. # Track changes to models for auditing or versioning.
gem "paper_trail" gem "paper_trail", "~> 15.2"
# Store active record objects in version whodunnits # Store active record objects in version whodunnits
gem "paper_trail-globalid" gem "paper_trail-globalid"

6
Gemfile.lock

@ -301,7 +301,7 @@ GEM
iniparse (~> 1.4) iniparse (~> 1.4)
rexml (~> 3.2) rexml (~> 3.2)
pagy (9.3.2) pagy (9.3.2)
paper_trail (15.1.0) paper_trail (15.2.0)
activerecord (>= 6.1) activerecord (>= 6.1)
request_store (~> 1.4) request_store (~> 1.4)
paper_trail-globalid (0.2.0) paper_trail-globalid (0.2.0)
@ -397,7 +397,7 @@ GEM
regexp_parser (2.9.0) regexp_parser (2.9.0)
reline (0.5.12) reline (0.5.12)
io-console (~> 0.5) io-console (~> 0.5)
request_store (1.6.0) request_store (1.7.0)
rack (>= 1.4) rack (>= 1.4)
responders (3.1.1) responders (3.1.1)
actionpack (>= 5.2) actionpack (>= 5.2)
@ -569,7 +569,7 @@ DEPENDENCIES
method_source (~> 1.1) method_source (~> 1.1)
notifications-ruby-client notifications-ruby-client
overcommit (>= 0.37.0) overcommit (>= 0.37.0)
paper_trail paper_trail (~> 15.2)
paper_trail-globalid paper_trail-globalid
parallel_tests parallel_tests
pg (~> 1.1) pg (~> 1.1)

16
app/models/scheme.rb

@ -145,7 +145,7 @@ class Scheme < ApplicationRecord
Yes: 1, Yes: 1,
}.freeze }.freeze
enum :sensitive, SENSITIVE, _suffix: true enum :sensitive, SENSITIVE, suffix: true
REGISTERED_UNDER_CARE_ACT = { REGISTERED_UNDER_CARE_ACT = {
"Yes – registered care home providing nursing care": 4, "Yes – registered care home providing nursing care": 4,
@ -164,7 +164,7 @@ class Scheme < ApplicationRecord
"Missing": 0, "Missing": 0,
}.freeze }.freeze
enum :scheme_type, SCHEME_TYPE, _suffix: true enum :scheme_type, SCHEME_TYPE, suffix: true
SUPPORT_TYPE = { SUPPORT_TYPE = {
"Missing": 0, "Missing": 0,
@ -175,7 +175,7 @@ class Scheme < ApplicationRecord
"Floating support": 6, "Floating support": 6,
}.freeze }.freeze
enum :support_type, SUPPORT_TYPE, _suffix: true enum :support_type, SUPPORT_TYPE, suffix: true
PRIMARY_CLIENT_GROUP = { PRIMARY_CLIENT_GROUP = {
"Homeless families with support needs": "O", "Homeless families with support needs": "O",
@ -197,8 +197,8 @@ class Scheme < ApplicationRecord
"Missing": "X", "Missing": "X",
}.freeze }.freeze
enum :primary_client_group, PRIMARY_CLIENT_GROUP, _suffix: true enum :primary_client_group, PRIMARY_CLIENT_GROUP, suffix: true
enum :secondary_client_group, PRIMARY_CLIENT_GROUP, _suffix: true enum :secondary_client_group, PRIMARY_CLIENT_GROUP, suffix: true
INTENDED_STAY = { INTENDED_STAY = {
"Very short stay": "V", "Very short stay": "V",
@ -213,8 +213,8 @@ class Scheme < ApplicationRecord
Yes: 1, Yes: 1,
}.freeze }.freeze
enum :intended_stay, INTENDED_STAY, _suffix: true enum :intended_stay, INTENDED_STAY, suffix: true
enum :has_other_client_group, HAS_OTHER_CLIENT_GROUP, _suffix: true enum :has_other_client_group, HAS_OTHER_CLIENT_GROUP, suffix: true
ARRANGEMENT_TYPE = { ARRANGEMENT_TYPE = {
"The same organisation that owns the housing stock": "D", "The same organisation that owns the housing stock": "D",
@ -226,7 +226,7 @@ class Scheme < ApplicationRecord
DUPLICATE_SCHEME_ATTRIBUTES = %w[scheme_type registered_under_care_act primary_client_group secondary_client_group has_other_client_group support_type intended_stay].freeze DUPLICATE_SCHEME_ATTRIBUTES = %w[scheme_type registered_under_care_act primary_client_group secondary_client_group has_other_client_group support_type intended_stay].freeze
enum :arrangement_type, ARRANGEMENT_TYPE, _suffix: true enum :arrangement_type, ARRANGEMENT_TYPE, suffix: true
def self.find_by_id_on_multiple_fields(scheme_id, location_id) def self.find_by_id_on_multiple_fields(scheme_id, location_id)
return if scheme_id.nil? return if scheme_id.nil?

4
config/locales/en.yml

@ -382,6 +382,10 @@ en:
organisation_part_of_another_merge: "This organisation is part of another merge - select a different one." organisation_part_of_another_merge: "This organisation is part of another merge - select a different one."
organisation_part_of_another_incomplete_merge: "Another merge request records %{organisation} as merging into %{absorbing_organisation} on %{merge_date}. Select another organisation or remove this organisation from the other merge request." organisation_part_of_another_incomplete_merge: "Another merge request records %{organisation} as merging into %{absorbing_organisation} on %{merge_date}. Select another organisation or remove this organisation from the other merge request."
organisation_not_selected: "Select an organisation from the search list." organisation_not_selected: "Select an organisation from the search list."
merge_request_id:
blank: "Select a merge request."
merging_organisation_id:
blank: "Select an organisation to merge."
soft_validations: soft_validations:
retirement: retirement:

2
db/migrate/20241206142943_create_active_storage_variant_records.active_storage.rb

@ -13,7 +13,7 @@ class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
end end
end end
private private
def primary_key_type def primary_key_type
config = Rails.configuration.generators config = Rails.configuration.generators

4
db/seeds.rb

@ -12,11 +12,11 @@ def find_or_create_user(organisation, email, name, role)
end end
end end
if LocalAuthority.count.zero? if LocalAuthority.count.zero?
la_path = "config/local_authorities_data/initial_local_authorities.csv" la_path = "config/local_authorities_data/initial_local_authorities.csv"
service = Imports::LocalAuthoritiesService.new(path: la_path) service = Imports::LocalAuthoritiesService.new(path: la_path)
service.call service.call
end end
unless Rails.env.test? unless Rails.env.test?
if LaRentRange.count.zero? if LaRentRange.count.zero?

Loading…
Cancel
Save