M src/Field.elm +16 -4
@@ 23,7 23,7 @@ wipToJustDone r field =
let
trackReworked x =
if x.conditions.rework == NeedsRework then
- { x | conditions = { reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, rework = Reworked } }
+ { x | conditions = { reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, interruptedProcessing = x.conditions.interruptedProcessing, rework = Reworked } }
else
x
@@ 73,9 73,21 @@ inflowToWip field =
-- nkit
+markInterruptedProcessing : Job -> Job
+markInterruptedProcessing x =
+ { x | conditions = { rework = x.conditions.rework, reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, interruptedProcessing = True } }
+
+
incompleteReqsFromWipToW2 : Field -> Field
incompleteReqsFromWipToW2 field =
- { field | w2 = field.w2 ++ List.filter (\x -> x.conditions.reqs == Incomplete) field.wip, wip = List.filter (\x -> x.conditions.reqs == Complete) field.wip }
+ let
+ incompletes =
+ List.map markInterruptedProcessing <| List.filter (\x -> x.conditions.reqs == Incomplete) field.wip
+
+ completes =
+ List.filter (\x -> x.conditions.reqs == Complete) field.wip
+ in
+ { field | w2 = field.w2 ++ incompletes, wip = completes }
type Changeability
@@ 133,7 145,7 @@ isScrap l j =
scrap : Maybe ScrapLimit -> Job -> Job
scrap l j =
- { j | conditions = { reqs = j.conditions.reqs, rework = j.conditions.rework, scrapped = Maybe.withDefault False <| Maybe.map (\x -> isScrap x j) l } }
+ { j | conditions = { reqs = j.conditions.reqs, rework = j.conditions.rework, interruptedProcessing = j.conditions.interruptedProcessing, scrapped = Maybe.withDefault False <| Maybe.map (\x -> isScrap x j) l } }
noScrap : Field -> Field
@@ 166,7 178,7 @@ justDoneToDone : Field -> Field
justDoneToDone field =
let
toRework =
- List.map (\x -> { x | conditions = { reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, rework = NeedsRework }, roundParams = { incomingRound = x.roundParams.incomingRound, doneRound = Nothing } }) <| List.filter (\x -> x.conditions.rework == NeedsRework) field.justDone
+ List.map (\x -> { x | conditions = { reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, interruptedProcessing = x.conditions.interruptedProcessing, rework = NeedsRework }, roundParams = { incomingRound = x.roundParams.incomingRound, doneRound = Nothing } }) <| List.filter (\x -> x.conditions.rework == NeedsRework) field.justDone
reallyDone =
List.filter (\x -> x.conditions.rework == NoRework || x.conditions.rework == Reworked) field.justDone
M src/Numbers.elm +9 -1
@@ 112,7 112,15 @@ decomposeNumber smaller5 xs todo =
decomposeNumber smaller5 (xs ++ [ addComponent ]) todoNew
-simplifyNumber : Bool -> Int -> List ( Int, Int )
+type alias BatchSize =
+ Int
+
+
+type alias BatchCount =
+ Int
+
+
+simplifyNumber : Bool -> Int -> List ( BatchSize, BatchCount )
simplifyNumber smaller5 =
summariseComponents << decomposeNumber smaller5 []
M src/Rework.elm +6 -1
@@ 83,7 83,12 @@ setReworks p ( kf, nkf ) =
setReworksFieldWrapper : ProbPerRound -> Field -> Random.Generator Field
setReworksFieldWrapper p field =
- detNoOfJobsRequiringRework p (List.length field.w0) |> Random.andThen (setReworksField field)
+ case p < 0.0001 of
+ True ->
+ Random.constant field
+
+ False ->
+ detNoOfJobsRequiringRework p (List.length field.w0) |> Random.andThen (setReworksField field)
setReworksField : Field -> Int -> Random.Generator Field
M src/Types.elm +10 -5
@@ 246,7 246,12 @@ type alias RoundParameters =
type alias NonRoundConditions =
- { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool }
+ { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool }
+
+
+
+-- = SquareFilling BorderColor Scrapped
+-- toColorCombo : NonRoundConditions -> ( SquareFilling, BorderColor, Scrapped )
type alias Job =
@@ 265,22 270,22 @@ getIncomingRound j =
icplNew : Int -> Job
icplNew n =
- { conditions = { reqs = Incomplete, rework = NoRework, scrapped = False }, roundParams = { incomingRound = n, doneRound = Nothing } }
+ { conditions = { reqs = Incomplete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = n, doneRound = Nothing } }
cplNew : Int -> Job
cplNew n =
- { conditions = { reqs = Complete, rework = NoRework, scrapped = False }, roundParams = { incomingRound = n, doneRound = Nothing } }
+ { conditions = { reqs = Complete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = n, doneRound = Nothing } }
cplDone : Int -> Int -> Job
cplDone from to =
- { conditions = { reqs = Complete, rework = NoRework, scrapped = False }, roundParams = { incomingRound = from, doneRound = Just to } }
+ { conditions = { reqs = Complete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = from, doneRound = Just to } }
icplDone : Int -> Int -> Job
icplDone from to =
- { conditions = { reqs = Incomplete, rework = NoRework, scrapped = False }, roundParams = { incomingRound = from, doneRound = Just to } }
+ { conditions = { reqs = Incomplete, rework = NoRework, scrapped = False, interruptedProcessing = False }, roundParams = { incomingRound = from, doneRound = Just to } }
type alias W2 =
M src/Views.elm +52 -25
@@ 34,6 34,11 @@ orange =
rgb255 255 153 0
+yellow : Color
+yellow =
+ rgb255 255 255 0
+
+
red : Color
red =
rgb255 230 74 69
@@ 137,19 142,22 @@ drawSquare sq n =
squareToColor sq =
let
- borderType scr =
- if scr then
- Border.dashed
+ incompleteReqs flavor =
+ [ Background.color grey, Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing ]
- else
- Border.solid
+ completeReqs flavor =
+ [ Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing ]
- incompleteReqs bc scr =
- [ Background.color grey, Border.width 1, Border.color bc, borderType scr ]
+ reqs flavor =
+ case flavor.squareFilling of
+ Black ->
+ incompleteReqs flavor
- completeReqs bc scr =
- [ Border.width 1, Border.color bc, borderType scr ]
+ -- .borderColor flavor.scrapped
+ White ->
+ completeReqs flavor
+ -- .borderColor flavor.scrapped
optionalMega x =
case x of
Normal ->
@@ 159,11 167,8 @@ squareToColor sq =
Just n
in
case sq of
- Square x Black bc scr ->
- ( incompleteReqs bc scr, optionalMega x )
-
- Square x White bc scr ->
- ( completeReqs bc scr, optionalMega x )
+ RealSquare params ->
+ ( reqs params.flavor, optionalMega params.variant )
PhantomSquare ->
( [], Nothing )
@@ 218,7 223,7 @@ type SquareFilling
type Square
- = Square SquareVariant SquareFilling BorderColor Scrapped
+ = RealSquare { variant : SquareVariant, flavor : VisualFlavor }
| PhantomSquare
@@ 275,6 280,13 @@ drawField squareSize perRow field label
column [ spacing 5 ] [ fieldContent, el [ Font.size 12, Element.moveRight 5 ] <| text label ]
+
+-- NonRoundConditions
+-- { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool }
+-- = SquareFilling BorderColor Scrapped
+-- toColorCombo : NonRoundConditions -> ( SquareFilling, BorderColor, Scrapped )
+
+
toBorderColor : ReworkCondition -> BorderColor
toBorderColor x =
case x of
@@ 308,12 320,22 @@ toBorderType scr =
Border.solid
-toColorCombo : ( Scrapped, RequirementsCondition, ReworkCondition ) -> ( SquareFilling, BorderColor, Scrapped )
-toColorCombo ( scr, req, rw ) =
- ( toFillingColor req
- , toBorderColor rw
- , scr
- )
+toFontColor : Bool -> Color
+toFontColor x =
+ if x then
+ yellow
+
+ else
+ black
+
+
+type alias VisualFlavor =
+ { squareFilling : SquareFilling, borderColor : BorderColor, scrapped : Bool, interruptedProcessing : Color }
+
+
+toVisualFlavor : NonRoundConditions -> VisualFlavor
+toVisualFlavor x =
+ { squareFilling = toFillingColor x.reqs, borderColor = toBorderColor x.rework, scrapped = x.scrapped, interruptedProcessing = toFontColor x.interruptedProcessing }
isSet : NonRoundConditions -> Job -> Maybe Job
@@ 329,17 351,22 @@ visibleSquares : Bool -> List Job -> Lis
visibleSquares smaller5 xs =
let
groups =
- List.Extra.gatherEqualsBy getThreeConditions xs
+ List.Extra.gatherEqualsBy .conditions xs
counts =
- List.map (\( x, ys ) -> ( toColorCombo <| getThreeConditions x, (\z -> z + 1) <| List.length ys )) groups
+ List.map (\( x, ys ) -> ( toVisualFlavor <| .conditions x, (\z -> z + 1) <| List.length ys )) groups
- perGroup ( ( sf, bc, scr ), y ) =
- List.concatMap (\( bs, n ) -> List.repeat n <| Square (Mega bs) sf bc scr) <| simplifyNumber smaller5 y
+ perGroup ( flavor, n ) =
+ List.concatMap (\( batchSize, batchCount ) -> List.repeat batchCount <| RealSquare { variant = Mega batchSize, flavor = flavor }) <| simplifyNumber smaller5 n
in
List.concatMap perGroup counts
+
+-- { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool }
+-- = SquareFilling BorderColor Scrapped
+
+
getThreeConditions : Job -> ( Scrapped, RequirementsCondition, ReworkCondition )
getThreeConditions x =
( x.conditions.scrapped, x.conditions.reqs, x.conditions.rework )