Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
1.3.1 tests pass again contract_attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfliegner committed Apr 11, 2023
1 parent 97a4e7b commit 0c24757
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"julia.executablePath": "~/julia-1.8.2/bin/julia",
"julia.executablePath": "$(JULIA_HOME)",
"sqltools.connections": [
{
"previewLimit": 50,
Expand Down
8 changes: 4 additions & 4 deletions src/LifeInsuranceDataModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions test/Manifest.toml
Original file line number Diff line number Diff line change
@@ -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]
30 changes: 11 additions & 19 deletions testCreateContract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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(
Expand All @@ -270,8 +264,7 @@ LifeInsuranceDataModel.load_model()
w1,
cpi,
LifeRiskTIODProduct,
Partner1,
PartnerRole,
PartnerroleMap,
)
commit_workflow!(w1)
# update Contract yellow
Expand Down Expand Up @@ -329,8 +322,7 @@ LifeInsuranceDataModel.load_model()
w4,
cpi,
LifeRiskTIODProduct,
Partner1,
PartnerRole,
PartnerroleMap,
)
commit_workflow!(w4)

Expand Down

4 comments on commit 0c24757

@michaelfliegner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release Notes
1.3.1 all tests pass after contract_attributes changes

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/81375

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.3.1 -m "<description of version>" 0c247579a1c638171c97d78097d317579c301c8a
git push origin v1.3.1

@michaelfliegner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release Notes
1.3.1 all tests pass after contract_attributes changes corr compat NBInclude

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/81375

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.3.1 -m "<description of version>" 0c247579a1c638171c97d78097d317579c301c8a
git push origin v1.3.1

Please sign in to comment.