File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
tutorial/step_2_business_language/src/Morphir/Example/App Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,29 @@ import Morphir.Example.App.Winds exposing (..)
8
8
decide : WindCategory -> ForecastDetail -> CurrentInventory -> ProbableReservations -> PendingReturns -> RequestedQuantity -> AllowPartials -> Result Reason ReservationQuantity
9
9
decide windCategory forecastDetail inventory probableReservations returns requestedQuantity allowPartials =
10
10
let
11
- isClosed : Bool
12
- isClosed = ( windCategory == DangerousWinds ) || ( forecastDetail == Thunderstorms )
11
+ safeConditions : Bool
12
+ safeConditions =
13
+ case ( windCategory, forecastDetail ) of
14
+ ( DangerousWinds , _ ) ->
15
+ False
16
+
17
+ ( _, Thunderstorms ) ->
18
+ False
19
+
20
+ ( HighWinds , Snow ) ->
21
+ False
22
+
23
+ ( HighWinds , Fog ) ->
24
+ False
25
+
26
+ _ ->
27
+ True
13
28
14
29
availability : Availability
15
30
availability =
16
31
inventory - probableReservations + returns
17
32
in
18
- if isClosed then
33
+ if not safeConditions then
19
34
Err ClosedDueToConditions
20
35
21
36
else if availability == 0 then
Original file line number Diff line number Diff line change @@ -10,10 +10,10 @@ categorizeWind windSpeed =
10
10
Calm
11
11
12
12
else if windSpeed < 20 then
13
- HighWinds
13
+ Windy
14
14
15
15
else if windSpeed < 30 then
16
- Windy
16
+ HighWinds
17
17
18
18
else
19
19
DangerousWinds
You can’t perform that action at this time.
0 commit comments