# HG changeset patch # User Benjamin Weber # Date 1667998757 -3600 # Wed Nov 09 13:59:17 2022 +0100 # Node ID dfda6e29fefd933a2673b64b97d82967061addf6 # Parent 163533adcd0ed41d3131492f3a7abcbe55c3ba0a display interrupted jobs with yellow Font.color diff --git a/src/Field.elm b/src/Field.elm --- a/src/Field.elm +++ b/src/Field.elm @@ -23,7 +23,7 @@ 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 @@ -- 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 @@ 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 = 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 diff --git a/src/Numbers.elm b/src/Numbers.elm --- a/src/Numbers.elm +++ b/src/Numbers.elm @@ -112,7 +112,15 @@ 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 [] diff --git a/src/Rework.elm b/src/Rework.elm --- a/src/Rework.elm +++ b/src/Rework.elm @@ -83,7 +83,12 @@ 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 diff --git a/src/Types.elm b/src/Types.elm --- a/src/Types.elm +++ b/src/Types.elm @@ -246,7 +246,12 @@ 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 @@ 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 = diff --git a/src/Views.elm b/src/Views.elm --- a/src/Views.elm +++ b/src/Views.elm @@ -34,6 +34,11 @@ rgb255 255 153 0 +yellow : Color +yellow = + rgb255 255 255 0 + + red : Color red = rgb255 230 74 69 @@ -137,19 +142,22 @@ 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 @@ 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 Square - = Square SquareVariant SquareFilling BorderColor Scrapped + = RealSquare { variant : SquareVariant, flavor : VisualFlavor } | PhantomSquare @@ -275,6 +280,13 @@ 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 @@ 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 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 )