diff --git a/.vscode/settings.json b/.vscode/settings.json index f019d55..111ec34 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "julia.executablePath": "~/julia-1.8.2/bin/julia", + "julia.executablePath": "$(JULIA_HOME)", "sqltools.connections": [ { "previewLimit": 50, diff --git a/src/LifeInsuranceDataModel.jl b/src/LifeInsuranceDataModel.jl index e485862..248ef6e 100644 --- a/src/LifeInsuranceDataModel.jl +++ b/src/LifeInsuranceDataModel.jl @@ -409,9 +409,9 @@ function instantiate_product(prs::ProductSection, partnerrolemap::Dict{Integer,P let tiprs = map(pt.ref.partner_roles) do r TariffItemPartnerReference(rev=TariffItemPartnerRefRevision(ref_role=r.ref_role.value, ref_partner=partnerrolemap[r.ref_role.value].revision.id)) end - tir = TariffItemRevision(ref_role=pt.revision.ref_role, ref_tariff=pt.revision.ref_tariff, parameters=pt.ref.revision.parameters) + tir = TariffItemRevision(ref_role=pt.revision.ref_role, ref_tariff=pt.revision.ref_tariff, contract_attributes=pt.ref.revision.contract_attributes) titr = TariffItemTariffReference(ref=pt.ref, rev=tir) - ca = JSON.parse(tir.parameters) + ca = JSON.parse(tir.contract_attributes) TariffItemSection(tariff_ref=titr, partner_refs=tiprs, contract_attributes=ca) end end @@ -500,7 +500,7 @@ function persistModelStateContract(previous::Dict{String,Any}, current::Dict{Str for j in 1:length(current["product_items"][i]["tariff_items"]) let curr = current["product_items"][i]["tariff_items"][j]["tariff_ref"]["rev"] - curr["parameters"] = JSON.json(current["product_items"][i]["tariff_items"][j]["contract_attributes"]) + curr["contract_attributes"] = JSON.json(current["product_items"][i]["tariff_items"][j]["contract_attributes"]) ticomponent = pisubcomponent tisubcomponent = get_typeof_component(ToStruct.tostruct(TariffItemRevision, curr))() @info ("INSERT/DELETE tariff item " * string(i) * "/" * string(j) * "c=" * string(ticomponent.id.value)) @@ -531,7 +531,7 @@ function persistModelStateContract(previous::Dict{String,Any}, current::Dict{Str for j in 1:length(current["product_items"][i]["tariff_items"]) let curr = current["product_items"][i]["tariff_items"][j]["tariff_ref"]["rev"] - curr["parameters"] = JSON.json(current["product_items"][i]["tariff_items"][j]["contract_attributes"]) + curr["contract_attributes"] = JSON.json(current["product_items"][i]["tariff_items"][j]["contract_attributes"]) prev = previous["product_items"][i]["tariff_items"][j]["tariff_ref"]["rev"] tirr = compareRevisions(TariffItemRevision, prev, curr) if !isnothing(tirr) diff --git a/test/Manifest.toml b/test/Manifest.toml new file mode 100644 index 0000000..e20d4e1 --- /dev/null +++ b/test/Manifest.toml @@ -0,0 +1,7 @@ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.8.2" +manifest_format = "2.0" +project_hash = "da39a3ee5e6b4b0d3255bfef95601890afd80709" + +[deps] diff --git a/testCreateContract.jl b/testCreateContract.jl index e0b229e..03b9b79 100644 --- a/testCreateContract.jl +++ b/testCreateContract.jl @@ -86,22 +86,12 @@ LifeInsuranceDataModel.load_model() } """ - LifeRiskTariff = create_tariff("Life Risk Insurance", 1, 0.02, "1980 CET - Male Nonsmoker, ANB", tariffparameters, contract_attributes) - TerminalIllnessTariff = create_tariff( - "Terminal Illness", 2, 0.02, - "2001 VBT Residual Standard Select and Ultimate - Male Nonsmoker, ANB", tariffparameters, contract_attributes - ) - OccupationalDisabilityTariff = create_tariff( - "Occupational Disability", 2, 0.02, - "2001 VBT Residual Standard Select and Ultimate - Male Nonsmoker, ANB", tariffparameters, contract_attributes - ) - ProfitParticipationTariff = create_tariff( - "Profit participation", 2, 0.02, - "2001 VBT Residual Standard Select and Ultimate - Male Nonsmoker, ANB", tariffparameters, contract_attributes - ) + LifeRiskTariff = create_tariff("Life Risk Insurance", 1, tariffparameters, contract_attributes) + TerminalIllnessTariff = create_tariff("Terminal Illness", 2, tariffparameters, contract_attributes) + OccupationalDisabilityTariff = create_tariff("Occupational Disability", 2, tariffparameters, contract_attributes) + ProfitParticipationTariff = create_tariff("Profit participation", 2, tariffparameters, contract_attributes) LifeRiskTariff2 = create_tariff( - "Two Life Risk Insurance", 2, 0.02, - "2001 VBT Residual Standard Select and Ultimate - Male Nonsmoker, ANB", tariffparameters, contract_attributes, [1, 2]) + "Two Life Risk Insurance", 2, "{}", contract_attributes, [1, 2]) find(TariffRevision) find(Tariff, SQLWhereExpression("id=?", ProfitParticipationTariff)) @@ -257,7 +247,11 @@ LifeInsuranceDataModel.load_model() create_subcomponent!(c, cpr, cprr, w1) # pi 1 LifeRiskTIODProduct = find(Product, SQLWhereExpression("id=?", 2))[1].id.value + PartnerroleMap = Dict{Integer,PartnerSection}() PartnerRole = tiprRole["Insured Person"] + PartnerroleMap[PartnerRole] = psection(Partner1, now(tz"UTC"), w1.tsw_validfrom, 0) + PartnerRole = tiprRole["2nd Insured Person"] + PartnerroleMap[PartnerRole] = psection(Partner2, now(tz"UTC"), w1.tsw_validfrom, 0) cpi = ProductItem(ref_super=c.id) cpir = ProductItemRevision( @@ -270,8 +264,7 @@ LifeInsuranceDataModel.load_model() w1, cpi, LifeRiskTIODProduct, - Partner1, - PartnerRole, + PartnerroleMap, ) commit_workflow!(w1) # update Contract yellow @@ -329,8 +322,7 @@ LifeInsuranceDataModel.load_model() w4, cpi, LifeRiskTIODProduct, - Partner1, - PartnerRole, + PartnerroleMap, ) commit_workflow!(w4)