Browse Source

Humanise the variable name"

pull/127/head
Kat 4 years ago
parent
commit
900f0603b2
  1. 2
      app/admin/organisations.rb
  2. 2
      app/models/case_log.rb
  3. 4
      app/models/organisation.rb
  4. 1
      spec/factories/organisation.rb
  5. 2
      spec/models/case_log_spec.rb
  6. 2
      spec/models/organisation_spec.rb

2
app/admin/organisations.rb

@ -17,7 +17,7 @@ ActiveAdmin.register Organisation do
selectable_column
id_column
column :name
column "org_type", :providertype
column "Org type", :providertype
column "Address Line 1", :address_line1
column "Address Line 2", :address_line2
column :postcode

2
app/models/case_log.rb

@ -192,7 +192,7 @@ private
self.incref = 1 if net_income_known == "Prefer not to say"
self.hhmemb = other_hhmemb + 1 if other_hhmemb.present?
self.renttype = RENT_TYPE_MAPPING[rent_type]
self.lettype = "#{renttype} #{needstype} #{owning_organisation.org_type}" if renttype.present? && needstype.present? && owning_organisation.org_type.present?
self.lettype = "#{renttype} #{needstype} #{owning_organisation['Org type']}" if renttype.present? && needstype.present? && owning_organisation["Org type"].present?
end
def all_fields_completed?

4
app/models/organisation.rb

@ -4,7 +4,7 @@ class Organisation < ApplicationRecord
has_many :managed_case_logs, class_name: "CaseLog", foreign_key: "managing_organisation_id"
include DbEnums
enum org_type: DbEnums.org_type, _suffix: true
enum "Org type": DbEnums.org_type, _suffix: true
def case_logs
CaseLog.for_organisation(self)
@ -27,7 +27,7 @@ class Organisation < ApplicationRecord
name: name,
address: address_string,
telephone_number: phone,
type: org_type,
type: "Org type",
local_authorities_operated_in: local_authorities,
holds_own_stock: holds_own_stock,
other_stock_owners: other_stock_owners,

1
spec/factories/organisation.rb

@ -1,7 +1,6 @@
FactoryBot.define do
factory :organisation do
name { "DLUHC" }
org_type { "LA" }
address_line1 { "2 Marsham Street" }
address_line2 { "London" }
postcode { "SW1P 4DF" }

2
spec/models/case_log_spec.rb

@ -838,7 +838,7 @@ RSpec.describe Form, type: :model do
describe "derived variables" do
require "date"
let(:organisation) { FactoryBot.create(:organisation, org_type: "PRP") }
let(:organisation) { FactoryBot.create(:organisation, "Org type": "PRP") }
let!(:case_log) do
CaseLog.create({
managing_organisation: organisation,

2
spec/models/organisation_spec.rb

@ -6,7 +6,7 @@ RSpec.describe Organisation, type: :model do
let(:organisation) { user.organisation }
it "has expected fields" do
expect(organisation.attribute_names).to include("name", "phone", "org_type")
expect(organisation.attribute_names).to include("name", "phone", "Org type")
end
it "has users" do

Loading…
Cancel
Save