Skip to content

Commit

Permalink
Update paper_trail, add missing translations, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kosiakkatrina committed Dec 9, 2024
1 parent 8d86634 commit 8239e3a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ gem "view_component", "~> 3.9"
# Use the AWS S3 SDK as storage mechanism
gem "aws-sdk-s3"
# Track changes to models for auditing or versioning.
gem "paper_trail"
gem "paper_trail", "~> 15.2"
# Store active record objects in version whodunnits
gem "paper_trail-globalid"

Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ GEM
iniparse (~> 1.4)
rexml (~> 3.2)
pagy (6.5.0)
paper_trail (15.1.0)
paper_trail (15.2.0)
activerecord (>= 6.1)
request_store (~> 1.4)
paper_trail-globalid (0.2.0)
Expand Down Expand Up @@ -397,7 +397,7 @@ GEM
regexp_parser (2.9.0)
reline (0.5.12)
io-console (~> 0.5)
request_store (1.6.0)
request_store (1.7.0)
rack (>= 1.4)
responders (3.1.1)
actionpack (>= 5.2)
Expand Down Expand Up @@ -569,7 +569,7 @@ DEPENDENCIES
method_source (~> 1.1)
notifications-ruby-client
overcommit (>= 0.37.0)
paper_trail
paper_trail (~> 15.2)
paper_trail-globalid
parallel_tests
pg (~> 1.1)
Expand Down
16 changes: 8 additions & 8 deletions app/models/scheme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Scheme < ApplicationRecord
Yes: 1,
}.freeze

enum :sensitive, SENSITIVE, _suffix: true
enum :sensitive, SENSITIVE, suffix: true

REGISTERED_UNDER_CARE_ACT = {
"Yes – registered care home providing nursing care": 4,
Expand All @@ -164,7 +164,7 @@ class Scheme < ApplicationRecord
"Missing": 0,
}.freeze

enum :scheme_type, SCHEME_TYPE, _suffix: true
enum :scheme_type, SCHEME_TYPE, suffix: true

SUPPORT_TYPE = {
"Missing": 0,
Expand All @@ -175,7 +175,7 @@ class Scheme < ApplicationRecord
"Floating support": 6,
}.freeze

enum :support_type, SUPPORT_TYPE, _suffix: true
enum :support_type, SUPPORT_TYPE, suffix: true

PRIMARY_CLIENT_GROUP = {
"Homeless families with support needs": "O",
Expand All @@ -197,8 +197,8 @@ class Scheme < ApplicationRecord
"Missing": "X",
}.freeze

enum :primary_client_group, PRIMARY_CLIENT_GROUP, _suffix: true
enum :secondary_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

INTENDED_STAY = {
"Very short stay": "V",
Expand All @@ -213,8 +213,8 @@ class Scheme < ApplicationRecord
Yes: 1,
}.freeze

enum :intended_stay, INTENDED_STAY, _suffix: true
enum :has_other_client_group, HAS_OTHER_CLIENT_GROUP, _suffix: true
enum :intended_stay, INTENDED_STAY, suffix: true
enum :has_other_client_group, HAS_OTHER_CLIENT_GROUP, suffix: true

ARRANGEMENT_TYPE = {
"The same organisation that owns the housing stock": "D",
Expand All @@ -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

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)
return if scheme_id.nil?
Expand Down
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ en:
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_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:
retirement:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ def change
end
end

private
private

def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end
def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end

def blobs_primary_key_type
pkey_name = connection.primary_key(:active_storage_blobs)
pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
pkey_column.bigint? ? :bigint : pkey_column.type
end
def blobs_primary_key_type
pkey_name = connection.primary_key(:active_storage_blobs)
pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
pkey_column.bigint? ? :bigint : pkey_column.type
end
end

0 comments on commit 8239e3a

Please sign in to comment.