Skip to content

Commit

Permalink
fix: adding shapelimits when shape is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper Bollen authored and Casper Bollen committed Feb 17, 2024
1 parent 9b26395 commit 1fff133
Showing 1 changed file with 41 additions and 39 deletions.
80 changes: 41 additions & 39 deletions src/Informedica.GenForm.Lib/DoseRule.fs
Original file line number Diff line number Diff line change
Expand Up @@ -656,45 +656,47 @@ module DoseRule =
|> Units.Volume.dropletSetDropsPerMl m
|> ValueUnit.withValue v

Mapping.filterRouteShapeUnit dr.Route dr.Shape NoUnit
|> Array.map (fun rsu ->
{ DoseLimit.limit with
DoseLimitTarget = dr.Shape |> ShapeLimitTarget
Quantity =
{
Min = rsu.MinDoseQty |> Option.map Limit.Inclusive
Max = rsu.MaxDoseQty |> Option.map Limit.Inclusive
}
}
|> fun dl ->
if droplets |> Option.isNone then dl
else
{ dl with
DoseUnit =
droplets
|> Option.map Units.Volume.dropletWithDropsPerMl
|> Option.defaultValue rsu.DoseUnit
Quantity =
{
Min =
dl.Quantity.Min
|> Option.map (
Limit.apply
setDroplet
setDroplet
)
Max =
dl.Quantity.Max
|> Option.map (
Limit.apply
setDroplet
setDroplet
)
}

}
)
|> Array.distinct
if dr.Shape |> String.isNullOrWhiteSpace then [||]
else
Mapping.filterRouteShapeUnit dr.Route dr.Shape NoUnit
|> Array.map (fun rsu ->
{ DoseLimit.limit with
DoseLimitTarget = dr.Shape |> ShapeLimitTarget
Quantity =
{
Min = rsu.MinDoseQty |> Option.map Limit.Inclusive
Max = rsu.MaxDoseQty |> Option.map Limit.Inclusive
}
}
|> fun dl ->
if droplets |> Option.isNone then dl
else
{ dl with
DoseUnit =
droplets
|> Option.map Units.Volume.dropletWithDropsPerMl
|> Option.defaultValue rsu.DoseUnit
Quantity =
{
Min =
dl.Quantity.Min
|> Option.map (
Limit.apply
setDroplet
setDroplet
)
Max =
dl.Quantity.Max
|> Option.map (
Limit.apply
setDroplet
setDroplet
)
}

}
)
|> Array.distinct

rs
|> Array.map (fun r ->
Expand Down

0 comments on commit 1fff133

Please sign in to comment.