Browse Source

Fix prevten inferred values, revert routing change for prevten (#369)

* Fix prevten inferred values, revert routing change for prevten

* tests
pull/370/head
kosiakkatrina 3 years ago committed by GitHub
parent
commit
a9b9381215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/models/case_log.rb
  2. 4
      config/forms/2021_2022.json
  3. 2
      spec/fixtures/exports/case_logs.xml
  4. 8
      spec/models/case_log_spec.rb

4
app/models/case_log.rb

@ -304,8 +304,8 @@ private
self.layear = 1 self.layear = 1
end end
if is_general_needs? if is_general_needs?
self.prevten = 2 if managing_organisation.provider_type == "PRP" self.prevten = 32 if managing_organisation.provider_type == "PRP"
self.prevten = 0 if managing_organisation.provider_type == "LA" self.prevten = 30 if managing_organisation.provider_type == "LA"
end end
end end

4
config/forms/2021_2022.json

@ -3598,7 +3598,7 @@
"depends_on": [ "depends_on": [
{ {
"renewal": 0, "renewal": 0,
"needstype": 1 "needstype": 0
} }
] ]
}, },
@ -3624,7 +3624,7 @@
"depends_on": [ "depends_on": [
{ {
"renewal": 1, "renewal": 1,
"needstype": 1 "needstype": 0
} }
] ]
}, },

2
spec/fixtures/exports/case_logs.xml vendored

@ -10,7 +10,7 @@
<sex1>F</sex1> <sex1>F</sex1>
<ethnic>2</ethnic> <ethnic>2</ethnic>
<national>4</national> <national>4</national>
<prevten>2</prevten> <prevten>32</prevten>
<ecstat1>0</ecstat1> <ecstat1>0</ecstat1>
<hhmemb>2</hhmemb> <hhmemb>2</hhmemb>
<age2>32</age2> <age2>32</age2>

8
spec/models/case_log_spec.rb

@ -631,15 +631,15 @@ RSpec.describe CaseLog do
case_log.update!({ needstype: 1 }) case_log.update!({ needstype: 1 })
record_from_db = ActiveRecord::Base.connection.execute("select prevten from case_logs where id=#{case_log.id}").to_a[0] record_from_db = ActiveRecord::Base.connection.execute("select prevten from case_logs where id=#{case_log.id}").to_a[0]
expect(record_from_db["prevten"]).to eq(2) expect(record_from_db["prevten"]).to eq(32)
expect(case_log["prevten"]).to eq(2) expect(case_log["prevten"]).to eq(32)
case_log.managing_organisation.update!({ provider_type: "LA" }) case_log.managing_organisation.update!({ provider_type: "LA" })
case_log.update!({ needstype: 1 }) case_log.update!({ needstype: 1 })
record_from_db = ActiveRecord::Base.connection.execute("select prevten from case_logs where id=#{case_log.id}").to_a[0] record_from_db = ActiveRecord::Base.connection.execute("select prevten from case_logs where id=#{case_log.id}").to_a[0]
expect(record_from_db["prevten"]).to eq(0) expect(record_from_db["prevten"]).to eq(30)
expect(case_log["prevten"]).to eq(0) expect(case_log["prevten"]).to eq(30)
end end
it "correctly derives and saves referral" do it "correctly derives and saves referral" do

Loading…
Cancel
Save