record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(50.06)
expect(case_log.wsupchrg).toeq(30.06)
expect(case_log.wpschrge).toeq(50.07)
expect(case_log.wpschrge).toeq(30.06)
expect(case_log.wscharge).toeq(50.49)
expect(case_log.wscharge).toeq(30.49)
expect(case_log.wrent).toeq(50.49)
expect(case_log.wrent).toeq(30.49)
expect(case_log.wtcharge).toeq(201.1)
expect(case_log.wtcharge).toeq(121.1)
expect(record_from_db["wsupchrg"]).toeq(50.06)
expect(record_from_db["wsupchrg"]).toeq(30.06)
expect(record_from_db["wpschrge"]).toeq(50.07)
expect(record_from_db["wpschrge"]).toeq(30.06)
expect(record_from_db["wscharge"]).toeq(50.49)
expect(record_from_db["wscharge"]).toeq(30.49)
expect(record_from_db["wrent"]).toeq(50.49)
expect(record_from_db["wrent"]).toeq(30.49)
expect(record_from_db["wtcharge"]).toeq(201.1)
expect(record_from_db["wtcharge"]).toeq(121.1)
end
end
end
end
@ -575,24 +593,24 @@ RSpec.describe CaseLog do
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:5)
case_log.update!(scharge:20,period:5)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(125.0)
expect(case_log.wscharge).toeq(19.23)
expect(record_from_db["wscharge"]).toeq(125.0)
expect(record_from_db["wscharge"]).toeq(19.23)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:5)
case_log.update!(pscharge:20,period:5)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(125.0)
expect(case_log.wpschrge).toeq(19.23)
expect(record_from_db["wpschrge"]).toeq(125.0)
expect(record_from_db["wpschrge"]).toeq(19.23)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:5)
case_log.update!(supcharg:20,period:5)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(125.0)
expect(case_log.wsupchrg).toeq(19.23)
expect(record_from_db["wsupchrg"]).toeq(125.0)
expect(record_from_db["wsupchrg"]).toeq(19.23)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(96.27)
expect(case_log.wsupchrg).toeq(19.35)
expect(case_log.wpschrge).toeq(96.28)
expect(case_log.wpschrge).toeq(19.36)
expect(case_log.wscharge).toeq(97.1)
expect(case_log.wscharge).toeq(20.17)
expect(case_log.wrent).toeq(97.09)
expect(case_log.wrent).toeq(97.09)
expect(case_log.wtcharge).toeq(386.73)
expect(case_log.wtcharge).toeq(155.96)
expect(record_from_db["wsupchrg"]).toeq(96.27)
expect(record_from_db["wsupchrg"]).toeq(19.35)
expect(record_from_db["wpschrge"]).toeq(96.28)
expect(record_from_db["wpschrge"]).toeq(19.36)
expect(record_from_db["wscharge"]).toeq(97.1)
expect(record_from_db["wscharge"]).toeq(20.17)
expect(record_from_db["wrent"]).toeq(97.09)
expect(record_from_db["wrent"]).toeq(97.09)
expect(record_from_db["wtcharge"]).toeq(386.73)
expect(record_from_db["wtcharge"]).toeq(155.96)
end
end
end
end
@ -656,24 +674,24 @@ RSpec.describe CaseLog do
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:6)
case_log.update!(scharge:30,period:6)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(122.5)
expect(case_log.wscharge).toeq(28.27)
expect(record_from_db["wscharge"]).toeq(122.5)
expect(record_from_db["wscharge"]).toeq(28.27)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:6)
case_log.update!(pscharge:30,period:6)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(122.5)
expect(case_log.wpschrge).toeq(28.27)
expect(record_from_db["wpschrge"]).toeq(122.5)
expect(record_from_db["wpschrge"]).toeq(28.27)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:6)
case_log.update!(supcharg:30,period:6)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(122.5)
expect(case_log.wsupchrg).toeq(28.27)
expect(record_from_db["wsupchrg"]).toeq(122.5)
expect(record_from_db["wsupchrg"]).toeq(28.27)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(94.34)
expect(case_log.wsupchrg).toeq(28.38)
expect(case_log.wpschrge).toeq(94.35)
expect(case_log.wpschrge).toeq(28.39)
expect(case_log.wscharge).toeq(95.15)
expect(case_log.wscharge).toeq(29.19)
expect(case_log.wrent).toeq(95.14)
expect(case_log.wrent).toeq(95.14)
expect(case_log.wtcharge).toeq(379)
expect(case_log.wtcharge).toeq(181.11)
expect(record_from_db["wsupchrg"]).toeq(94.34)
expect(record_from_db["wsupchrg"]).toeq(28.38)
expect(record_from_db["wpschrge"]).toeq(94.35)
expect(record_from_db["wpschrge"]).toeq(28.39)
expect(record_from_db["wscharge"]).toeq(95.15)
expect(record_from_db["wscharge"]).toeq(29.19)
expect(record_from_db["wrent"]).toeq(95.14)
expect(record_from_db["wrent"]).toeq(95.14)
expect(record_from_db["wtcharge"]).toeq(379)
expect(record_from_db["wtcharge"]).toeq(181.11)
end
end
end
end
@ -737,24 +755,24 @@ RSpec.describe CaseLog do
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:7)
case_log.update!(scharge:30,period:7)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(120.0)
expect(case_log.wscharge).toeq(27.69)
expect(record_from_db["wscharge"]).toeq(120.0)
expect(record_from_db["wscharge"]).toeq(27.69)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:7)
case_log.update!(pscharge:30,period:7)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(120.0)
expect(case_log.wpschrge).toeq(27.69)
expect(record_from_db["wpschrge"]).toeq(120.0)
expect(record_from_db["wpschrge"]).toeq(27.69)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:7)
case_log.update!(supcharg:30,period:7)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(120.0)
expect(case_log.wsupchrg).toeq(27.69)
expect(record_from_db["wsupchrg"]).toeq(120.0)
expect(record_from_db["wsupchrg"]).toeq(27.69)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(92.42)
expect(case_log.wsupchrg).toeq(27.8)
expect(case_log.wpschrge).toeq(92.43)
expect(case_log.wpschrge).toeq(27.81)
expect(case_log.wscharge).toeq(93.21)
expect(case_log.wscharge).toeq(28.6)
expect(case_log.wrent).toeq(93.20)
expect(case_log.wrent).toeq(93.20)
expect(case_log.wtcharge).toeq(371.26)
expect(case_log.wtcharge).toeq(177.42)
expect(record_from_db["wsupchrg"]).toeq(92.42)
expect(record_from_db["wsupchrg"]).toeq(27.8)
expect(record_from_db["wpschrge"]).toeq(92.43)
expect(record_from_db["wpschrge"]).toeq(27.81)
expect(record_from_db["wscharge"]).toeq(93.21)
expect(record_from_db["wscharge"]).toeq(28.6)
expect(record_from_db["wrent"]).toeq(93.20)
expect(record_from_db["wrent"]).toeq(93.20)
expect(record_from_db["wtcharge"]).toeq(371.26)
expect(record_from_db["wtcharge"]).toeq(177.42)
end
end
end
end
@ -818,24 +836,24 @@ RSpec.describe CaseLog do
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:8)
case_log.update!(scharge:30,period:8)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(117.5)
expect(case_log.wscharge).toeq(27.12)
expect(record_from_db["wscharge"]).toeq(117.5)
expect(record_from_db["wscharge"]).toeq(27.12)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:8)
case_log.update!(pscharge:30,period:8)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(117.5)
expect(case_log.wpschrge).toeq(27.12)
expect(record_from_db["wpschrge"]).toeq(117.5)
expect(record_from_db["wpschrge"]).toeq(27.12)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:8)
case_log.update!(supcharg:30,period:8)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(117.5)
expect(case_log.wsupchrg).toeq(27.12)
expect(record_from_db["wsupchrg"]).toeq(117.5)
expect(record_from_db["wsupchrg"]).toeq(27.12)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(90.49)
expect(case_log.wsupchrg).toeq(27.22)
expect(case_log.wpschrge).toeq(90.50)
expect(case_log.wpschrge).toeq(27.23)
expect(case_log.wscharge).toeq(91.27)
expect(case_log.wscharge).toeq(28)
expect(case_log.wrent).toeq(91.26)
expect(case_log.wrent).toeq(91.26)
expect(case_log.wtcharge).toeq(363.53)
expect(case_log.wtcharge).toeq(173.72)
expect(record_from_db["wsupchrg"]).toeq(90.49)
expect(record_from_db["wsupchrg"]).toeq(27.22)
expect(record_from_db["wpschrge"]).toeq(90.50)
expect(record_from_db["wpschrge"]).toeq(27.23)
expect(record_from_db["wscharge"]).toeq(91.27)
expect(record_from_db["wscharge"]).toeq(28)
expect(record_from_db["wrent"]).toeq(91.26)
expect(record_from_db["wrent"]).toeq(91.26)
expect(record_from_db["wtcharge"]).toeq(363.53)
expect(record_from_db["wtcharge"]).toeq(173.72)
end
end
end
end
@ -899,24 +917,24 @@ RSpec.describe CaseLog do
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:9)
case_log.update!(scharge:30,period:9)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(115.0)
expect(case_log.wscharge).toeq(26.54)
expect(record_from_db["wscharge"]).toeq(115.0)
expect(record_from_db["wscharge"]).toeq(26.54)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:9)
case_log.update!(pscharge:30,period:9)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(115.0)
expect(case_log.wpschrge).toeq(26.54)
expect(record_from_db["wpschrge"]).toeq(115.0)
expect(record_from_db["wpschrge"]).toeq(26.54)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:9)
case_log.update!(supcharg:30,period:9)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(115.0)
expect(case_log.wsupchrg).toeq(26.54)
expect(record_from_db["wsupchrg"]).toeq(115.0)
expect(record_from_db["wsupchrg"]).toeq(26.54)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(88.57)
expect(case_log.wsupchrg).toeq(26.64)
expect(case_log.wpschrge).toeq(88.58)
expect(case_log.wpschrge).toeq(26.65)
expect(case_log.wscharge).toeq(89.33)
expect(case_log.wscharge).toeq(27.41)
expect(case_log.wrent).toeq(89.32)
expect(case_log.wrent).toeq(89.32)
expect(case_log.wtcharge).toeq(355.79)
expect(case_log.wtcharge).toeq(170.02)
expect(record_from_db["wsupchrg"]).toeq(88.57)
expect(record_from_db["wsupchrg"]).toeq(26.64)
expect(record_from_db["wpschrge"]).toeq(88.58)
expect(record_from_db["wpschrge"]).toeq(26.65)
expect(record_from_db["wscharge"]).toeq(89.33)
expect(record_from_db["wscharge"]).toeq(27.41)
expect(record_from_db["wrent"]).toeq(89.32)
expect(record_from_db["wrent"]).toeq(89.32)
expect(record_from_db["wtcharge"]).toeq(355.79)
expect(record_from_db["wtcharge"]).toeq(170.02)
end
end
end
end
@ -980,31 +998,31 @@ RSpec.describe CaseLog do
end
end
it"correctly derives and saves weekly service charge"do
it"correctly derives and saves weekly service charge"do
case_log.update!(scharge:130,period:1)
case_log.update!(scharge:30,period:1)
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wscharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wscharge).toeq(130.0)
expect(case_log.wscharge).toeq(30.0)
expect(record_from_db["wscharge"]).toeq(130.0)
expect(record_from_db["wscharge"]).toeq(30.0)
end
end
it"correctly derives and saves weekly personal service charge"do
it"correctly derives and saves weekly personal service charge"do
case_log.update!(pscharge:130,period:1)
case_log.update!(pscharge:30,period:1)
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wpschrge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wpschrge).toeq(130.0)
expect(case_log.wpschrge).toeq(30.0)
expect(record_from_db["wpschrge"]).toeq(130.0)
expect(record_from_db["wpschrge"]).toeq(30.0)
end
end
it"correctly derives and saves weekly support charge"do
it"correctly derives and saves weekly support charge"do
case_log.update!(supcharg:130,period:1)
case_log.update!(supcharg:30,period:1)
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wsupchrg from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wsupchrg).toeq(130.0)
expect(case_log.wsupchrg).toeq(30.0)
expect(record_from_db["wsupchrg"]).toeq(130.0)
expect(record_from_db["wsupchrg"]).toeq(30.0)
end
end
it"correctly derives and saves weekly total charge"do
it"correctly derives and saves weekly total charge"do
case_log.update!(tcharge:130,period:1)
case_log.update!(tcharge:30,period:1)
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge from case_logs where id=#{case_log.id}").to_a[0]
expect(case_log.wtcharge).toeq(130.0)
expect(case_log.wtcharge).toeq(30.0)
expect(record_from_db["wtcharge"]).toeq(130.0)
expect(record_from_db["wtcharge"]).toeq(30.0)
end
end
context"when the tenant has an outstanding amount after benefits"do
context"when the tenant has an outstanding amount after benefits"do
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]
record_from_db=ActiveRecord::Base.connection.execute("select wtcharge, wsupchrg, wpschrge, wscharge, wrent from case_logs where id=#{case_log.id}").to_a[0]