# HG changeset patch # User Benjamin Weber # Date 1668518711 -3600 # Tue Nov 15 14:25:11 2022 +0100 # Node ID 264e1f4159a832cb2adec54beb037478cfe5a707 # Parent 473a8981b640caa80551264bfe4a7af086b4fd72 work on highlighting kitForNkit in charts diff --git a/src/Charting.elm b/src/Charting.elm --- a/src/Charting.elm +++ b/src/Charting.elm @@ -22,7 +22,8 @@ { cmodel | hovering = Just hoverData, chartType = ReworkShare } OnHoverInterrupted hoverData -> - { cmodel | hovering = Just hoverData, chartType = InterruptedShare} + { cmodel | hovering = Just hoverData, chartType = InterruptedShare } + data = [ { round = 101, waitingNKIT = 85, doneNKIT = 117, waitingKIT = 14, doneKIT = 188 } @@ -31,9 +32,8 @@ , { round = 2001, waitingNKIT = 2000, doneNKIT = 2013, waitingKIT = 140, doneKIT = 3868 } ] - -twoLinesChart : ChartingModel -> List DoneData -> H.Html ChartingMsg -twoLinesChart cmodel doneData = +twoLinesChart : ChartingModel -> List DoneData -> List (Round, Round) -> H.Html ChartingMsg +twoLinesChart cmodel doneData kitForNkitStates = let hoverVariant = case cmodel.chartType of @@ -77,19 +77,25 @@ contentForInterrupted = dataPointsTwo "NKIT" .interruptedShareNKIT "KIT" .interruptedShareKIT - content = + + rect r1 r2 yMax = C.rect [CA.x1 r1, CA.y1 0, CA.x2 r2, CA.y2 yMax, CA.color "rgb(210, 210, 210)", CA.opacity 0.3] + + -- a: off -- empty list -- no problem + -- b: off, on, off until off round -- even -- no problem; edge case: multiple on and off in same round --> use last input + -- c: off, on -- ++ current round -- uneven -- add last round as end + (kitDataFunc, nkitDataFunc, content) = case cmodel.chartType of HowMuchDone -> - contentForDone + (.doneKIT, .doneNKIT, contentForDone) HowLongFloat -> - contentForFloat + (.flowtimeGKIT, .flowtimeGNKIT, contentForFloat) ReworkShare -> - contentForRework + (.reworkShareKIT, .reworkShareNKIT, contentForRework) InterruptedShare -> - contentForInterrupted + (.interruptedShareKIT, .interruptedShareNKIT, contentForInterrupted) in C.chart [ CA.height 200 @@ -99,6 +105,7 @@ ] [ C.xLabels [ CA.fontSize 12, CA.withGrid ] , C.yLabels [ CA.fontSize 12, CA.withGrid ] + , C.withPlane <| \p -> List.map (\(a,b) -> rect (toFloat <| max 1 a) (toFloat b) p.y.max) kitForNkitStates , content , C.each (Maybe.withDefault [] cmodel.hovering) <| \p item -> diff --git a/src/Field.elm b/src/Field.elm --- a/src/Field.elm +++ b/src/Field.elm @@ -72,18 +72,22 @@ -- nkit + markInterruptedProcessing : Job -> Job -markInterruptedProcessing x = {x | conditions = {rework = x.conditions.rework, reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, interruptedProcessing = True}} +markInterruptedProcessing x = + { x | conditions = { rework = x.conditions.rework, reqs = x.conditions.reqs, scrapped = x.conditions.scrapped, interruptedProcessing = True } } incompleteReqsFromWipToW2 : Field -> Field incompleteReqsFromWipToW2 field = let - incompletes = List.map markInterruptedProcessing <| List.filter (\x -> x.conditions.reqs == Incomplete) field.wip - completes = List.filter (\x -> x.conditions.reqs == Complete) field.wip + incompletes = + List.map markInterruptedProcessing <| List.filter (\x -> x.conditions.reqs == Incomplete) field.wip - in - { field | w2 = field.w2 ++ incompletes, wip = completes} + completes = + List.filter (\x -> x.conditions.reqs == Complete) field.wip + in + { field | w2 = field.w2 ++ incompletes, wip = completes } type Changeability @@ -253,7 +257,15 @@ applyStep : KITForNKIT -> ( FieldStep, FieldStep ) -> Model -> Model -applyStep kitForNkit ( k, n ) model = let nkitFunction = if kitForNkit then k else n in +applyStep kitForNkit ( k, n ) model = + let + nkitFunction = + if kitForNkit then + k + + else + n + in case ( k, nkitFunction ) of ( Just x, Just y ) -> { model | kit = y model.kit, nkit = x model.nkit } diff --git a/src/Main.elm b/src/Main.elm --- a/src/Main.elm +++ b/src/Main.elm @@ -105,7 +105,7 @@ else update (NextSteps (n - 1)) <| Tuple.first <| update (NextStep model.finishRound) model - + Step s -> case s of S0 -> @@ -120,18 +120,9 @@ S2 -> -- S2 does S3 - let - f = - conditionalScrap model.scrapLimit >> justDoneToDone >> wipToJustDone model.round - in - ( chain <| - applyStep model.kitForNkit - ( Just f - , Just f - ) - model - , Cmd.none - ) + let f = conditionalScrap model.scrapLimit >> justDoneToDone >> wipToJustDone model.round in + ( chain <| applyStep model.kitForNkit ( Just f, + Just f) model, Cmd.none ) -- FIXME: updatewaiting moves justDone to Done, which it shouldn't S3 -> @@ -201,8 +192,14 @@ else defaultToCurrentModel <| Maybe.map (\y -> applyStep model.kitForNkit ( Just <| identifyScrap y, Just <| identifyScrap y ) <| { model | scrapLimit = Just y }) <| validIntInput 0 500 x - SwapKITForNKIT -> - ( { model | kitForNkit = not model.kitForNkit }, Cmd.none ) + SwapKITForNKIT -> let newState = case model.kitForNkitState of + Nothing -> Just model.round + Just x -> Nothing + addStates = case model.kitForNkitState of + Just x -> [(x, model.round)] + Nothing -> [] + in + ( { model | kitForNkit = not model.kitForNkit, kitForNkitState = newState, kitForNkitStates = model.kitForNkitStates ++ addStates}, Cmd.none ) SwapAutoPlay -> ( { model | autoPlay = not model.autoPlay }, Cmd.none ) @@ -303,6 +300,11 @@ } +kitForNkitOpen : Maybe Round -> Round -> List (Round, Round) +kitForNkitOpen r cr = case r of + Just x -> [(x, cr)] + Nothing -> [] + view : Model -> Document Msg view model = let @@ -371,23 +373,12 @@ scrapLimitInterface = interface2 (String.fromInt <| Maybe.withDefault 0 model.scrapLimit) (Maybe.Extra.isNothing model.scrapLimit) [ text "scrap after", text "rounds" ] ChangedScrapLimit (text "rounds") - scrapShare = - case model.scrapLimit of - Nothing -> - Element.none - - Just _ -> - let - all = - getAll model.nkit - - scrapped = - List.filter (.conditions >> .scrapped) all - - share = - (\x -> x * 100) <| safeDiv (toFloat <| List.length scrapped) (toFloat <| List.length all) - in - column [ width fill, height fill, spacing 5 ] [ text <| String.fromFloat share ++ "% of jobs", text "in NKIT scrapped" ] + scrapShare = case model.scrapLimit of + Nothing -> Element.none + Just _ -> let all = getAll model.nkit + scrapped = List.filter (.conditions >> .scrapped) all + share = (\x -> x *100) <| safeDiv (toFloat <| List.length scrapped) (toFloat <| List.length all) + in column [width fill, height fill, spacing 5] [text <| String.fromFloat share ++ "% of jobs", text "in NKIT scrapped"] batchButtons = let @@ -466,16 +457,16 @@ playInterface = row [ spacing 10, padding 13, Font.size 12, width fill ] - [ column [ width fill, height fill, spacing 7 ] [ autoPlayer, kitForNkit ] + [ column [width fill, height fill, spacing 7] [autoPlayer, kitForNkit] , reworkProbInterface - , column [ width fill, height fill, spacing 5 ] [ scrapLimitInterface, scrapShare ] + , column [width fill, height fill, spacing 5] [scrapLimitInterface, scrapShare] --, stopThresholds ] kitForNkit = row [ Font.size 12, spacing 10, width fill ] - [ column [ spacing 5, Border.width 1, padding 5 ] [ text "KIT4NKIT", swapKITForNKITButton ] + [ column [ spacing 5, Border.width 1, padding 5 ] [ text "KIT4NKIT", swapKITForNKITButton] ] autoPlayer = @@ -483,6 +474,7 @@ [ column [ spacing 5, Border.width 1, padding 5 ] [ text "AutoPlay", autoPlayButton ] ] + --lower = -- row [ spacing 20, width fill, height fill ] [ viewField squareSizeUndone squareSizeDone model.nkit "NKIT", viewField squareSizeUndone squareSizeDone model.kit "KIT" ] netWidth = @@ -502,10 +494,6 @@ -- round <| squareSize * 1.5 outerPadding = 20 - - theChart = - viewChart model.stats.doneData - viewDoneStatWrapper f = Maybe.withDefault Element.none <| Maybe.map viewDoneStat <| List.head <| List.reverse <| f model @@ -524,10 +512,11 @@ column [ width fill, height fill, spacing 10 ] [ x, el [ paddingXY 10 0, Font.size 12 ] <| text t ] headedChart t1 t2 x = - column [ width fill, height fill, spacing 25 ] [ el [ paddingXY 10 0, Font.size 14, centerX ] <| column [ width fill, height fill ] [ text t1, text t2 ], theChart x ] + column [ width fill, height fill, spacing 25 ] [ el [ paddingXY 10 0, Font.size 14, centerX ] <| column [ width fill, height fill ] [ text t1, text t2 ], viewChart model.stats.doneData x <| Debug.log "kitForNkitStates" (model.kitForNkitStates ++ kitForNkitOpen model.kitForNkitState model.round)] + --viewChart model.stats.doneData in column [ width fill, height fill, spacing 30 ] - [ cc [ headedChart "jobs in todo interrupted" "[%]" model.chart0, headedChart "How much gets done?" "[incoming jobs]" model.chart1, headedChart "How long does it take?" "[jobs > 4 cycles flow time]" model.chart3, headedChart "How much rework?" "[jobs requiring rework]" model.chart5 ] + [ cc [ headedChart "jobs in todo interrupted" "[%]" model.chart0, headedChart "How much gets done?" "[% incoming jobs]" model.chart1, headedChart "How long does it take?" "[jobs > 4 cycles flow time]" model.chart3, headedChart "How much rework?" "[jobs requiring rework]" model.chart5 ] ] cy = @@ -568,8 +557,8 @@ column [ width fill, height fill ] [ r [ text "", c "throughput" "[jobs/cycle]", c "cap. utilisation" "[-]", c "avg. flow time" "[cycles/job]" ] , r [ text "inflow", text <| r2 ds.inflowedAvg, text "", text "" ] - , r [ text "todo", text <| ("+" ++ r2 ds.wipIncr), text "", text <| r2 ds.flowtimeWaiting ] - , r [ text "processing", text <| r2 ds.doneAvg, text <| r2 ds.capUtilisation, text <| r2 ds.flowtimeProcessingAvg ] + , r [ text "outflow", text <| r2 ds.doneAvg, text <| r2 ds.capUtilisation, text <| r2 ds.flowtimeProcessingAvg ] + , r [ text "+waiting", text <| ("+" ++ r2 ds.wipIncr), text "", text <| r2 ds.flowtimeWaiting ] , r [ text "total", text "", text "", text <| r2 <| ds.flowtimeWaiting + ds.flowtimeProcessingAvg ] ] diff --git a/src/Numbers.elm b/src/Numbers.elm --- a/src/Numbers.elm +++ b/src/Numbers.elm @@ -111,8 +111,13 @@ else decomposeNumber smaller5 (xs ++ [ addComponent ]) todoNew -type alias BatchSize = Int -type alias BatchCount = Int + +type alias BatchSize = + Int + + +type alias BatchCount = + Int simplifyNumber : Bool -> Int -> List ( BatchSize, BatchCount ) diff --git a/src/Rework.elm b/src/Rework.elm --- a/src/Rework.elm +++ b/src/Rework.elm @@ -5,6 +5,7 @@ import Random.List import Types exposing (..) + updateRework : Job -> ReworkCondition -> Job updateRework j rc = case j.conditions.rework of @@ -23,6 +24,7 @@ Random.weighted ( p, NeedsRework ) [ ( 100 - p, NoRework ) ] + -- new setRework mechanism to improve perf with increasing no. of jobs on w0 -- aim: constant computing amount for increasing no. of jobs on w0 -- relevance: rework mechanism consumes ≈ half of computing time, which is the biggest chunk @@ -80,9 +82,13 @@ setReworksFieldWrapper : ProbPerRound -> Field -> Random.Generator Field -setReworksFieldWrapper p field = case p < 0.0001 of - True -> Random.constant field - False -> detNoOfJobsRequiringRework p (List.length field.w0) |> Random.andThen (setReworksField field) +setReworksFieldWrapper p 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 @@ -99,11 +105,19 @@ Random.map (\( a, b ) -> toRework a ++ b) << choices n -choices : Int -> List a -> Random.Generator (List a, List a) -choices n xs = case n of - 0 -> Random.constant ([], xs) - _ -> let xs1 = Random.List.shuffle xs - in Random.map2 Tuple.pair (Random.map (List.take n) xs1) (Random.map (List.drop n) xs1) +choices : Int -> List a -> Random.Generator ( List a, List a ) +choices n xs = + case n of + 0 -> + Random.constant ( [], xs ) + + _ -> + let + xs1 = + Random.List.shuffle xs + in + Random.map2 Tuple.pair (Random.map (List.take n) xs1) (Random.map (List.drop n) xs1) + setReworksCmd : Model -> Cmd Msg setReworksCmd model = diff --git a/src/Round.elm b/src/Round.elm --- a/src/Round.elm +++ b/src/Round.elm @@ -43,7 +43,15 @@ bothFieldsRound : KITForNKIT -> Round -> ProbPerRound -> Maybe ScrapLimit -> ( Field, Field, Stats ) -> Random.Generator ( Field, Field, Stats ) -bothFieldsRound kitForNkit r p l ( kf, nkf, stats ) = let nkitFunction = if kitForNkit then kitAfterReworks else nkitAfterReworks in +bothFieldsRound kitForNkit r p l ( kf, nkf, stats ) = + let + nkitFunction = + if kitForNkit then + kitAfterReworks + + else + nkitAfterReworks + in Random.map (\( a, b ) -> ( a, b, trackStats (r + 1) a b stats )) <| Random.map2 Tuple.pair (fieldRound kitAfterReworks r p l kf) (fieldRound nkitFunction r p l nkf) diff --git a/src/Stats.elm b/src/Stats.elm --- a/src/Stats.elm +++ b/src/Stats.elm @@ -64,14 +64,13 @@ <| getAll f - safeDiv : Float -> Float -> Float safeDiv x y = - if y == 0 then - 0 + if y == 0 then + 0 - else - x / y + else + x / y createDataPoint : Round -> Field -> Field -> DoneData @@ -84,14 +83,9 @@ safeDiv (100 * (toFloat <| List.length <| List.filter (\x -> x.conditions.rework /= NoRework) xs)) (toFloat <| List.length xs) interruptedShare field = - let - totalNumber = - List.length field.w0 - - interrupted = - List.length <| List.filter (\x -> x.conditions.interruptedProcessing) field.w0 - in - (\x -> 100 * x) <| safeDiv (toFloat interrupted) (toFloat totalNumber) + let totalNumber = List.length field.w0 + interrupted = List.length <| List.filter (\x -> x.conditions.interruptedProcessing) field.w0 + in (\x -> 100 * x) <| safeDiv (toFloat interrupted) (toFloat totalNumber) flowtimeG n xs = safeDiv (100 * (toFloat <| List.length <| List.filter (\x -> x > n) xs)) (toFloat <| List.length xs) diff --git a/src/Types.elm b/src/Types.elm --- a/src/Types.elm +++ b/src/Types.elm @@ -8,15 +8,18 @@ type alias Model = - { viewport : Maybe Dom.Viewport, kit : Field, nkit : Field, round : Round, step : StepVariant, kitForNkit : Bool, finishRound : Bool, roundEmpty : Bool, stepEmpty : Bool, stopRoundEmpty : Bool, autoPlay : Bool, incrementMode : AutoPlayMode, reworkProbPerRound : Float, reworkProbPerRoundDot : Bool, reworkProbEmpty : Bool, scrapLimit : Maybe ScrapLimit, cyclesPerIncrement : Int, cyclesPerIncrementEmpty : Bool, chart0 : ChartingModel, chart1 : ChartingModel, chart3 : ChartingModel, chart5 : ChartingModel, stats : Stats } + { viewport : Maybe Dom.Viewport, kit : Field, nkit : Field, round : Round, step : StepVariant, kitForNkit : Bool, finishRound : Bool, roundEmpty : Bool, stepEmpty : Bool, stopRoundEmpty : Bool, autoPlay : Bool, incrementMode : AutoPlayMode, reworkProbPerRound : Float, reworkProbPerRoundDot : Bool, reworkProbEmpty : Bool, scrapLimit : Maybe ScrapLimit, cyclesPerIncrement : Int, cyclesPerIncrementEmpty : Bool, chart0 : ChartingModel, chart1 : ChartingModel, chart3 : ChartingModel, chart5 : ChartingModel, stats : Stats, kitForNkitState : Maybe Round, kitForNkitStates : List (Round, Round)} + initChart : ChartType -> ChartingModel initChart chartType = { hovering = Nothing, chartType = chartType } + chart0 : ChartingModel -chart0 = initChart InterruptedShare +chart0 = + initChart InterruptedShare chart1 : ChartingModel @@ -36,14 +39,17 @@ initModel : Model initModel = - { viewport = Nothing, nkit = initField, kit = initField, round = 0, step = S7, kitForNkit = False, finishRound = False, roundEmpty = False, stepEmpty = False, stopRoundEmpty = False, autoPlay = False, incrementMode = RoundMode, reworkProbPerRound = 0.5, reworkProbPerRoundDot = False, reworkProbEmpty = False, scrapLimit = Nothing, cyclesPerIncrement = 1, cyclesPerIncrementEmpty = False, chart0 = chart0, chart1 = chart1, chart3 = chart3, chart5 = chart5, stats = { flowtimesSinglesNKIT = [], flowtimesSinglesKIT = [], justDonesNKIT = [], justDonesKIT = [], doneData = [] } } + { viewport = Nothing, nkit = initField, kit = initField, round = 0, step = S7, kitForNkit = False, finishRound = False, roundEmpty = False, stepEmpty = False, stopRoundEmpty = False, autoPlay = False, incrementMode = RoundMode, reworkProbPerRound = 0.5, reworkProbPerRoundDot = False, reworkProbEmpty = False, scrapLimit = Nothing, cyclesPerIncrement = 1, cyclesPerIncrementEmpty = False, chart0 = chart0, chart1 = chart1, chart3 = chart3, chart5 = chart5, stats = { flowtimesSinglesNKIT = [], flowtimesSinglesKIT = [], justDonesNKIT = [], justDonesKIT = [], doneData = [] }, kitForNkitState = Nothing, kitForNkitStates = [] } type AutoPlayMode = RoundMode | StepMode -type alias KITForNKIT = Bool + +type alias KITForNKIT = + Bool + type Msg = ReceivedViewport Dom.Viewport @@ -253,10 +259,12 @@ type alias NonRoundConditions = { rework : ReworkCondition, reqs : RequirementsCondition, scrapped : Bool, interruptedProcessing : Bool } --- = SquareFilling BorderColor Scrapped + +-- = SquareFilling BorderColor Scrapped -- toColorCombo : NonRoundConditions -> ( SquareFilling, BorderColor, Scrapped ) + type alias Job = { conditions : NonRoundConditions, roundParams : RoundParameters } @@ -273,17 +281,17 @@ icplNew : Int -> Job icplNew n = - { conditions = { reqs = Incomplete, rework = NoRework, scrapped = False , interruptedProcessing = 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 , interruptedProcessing = 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, interruptedProcessing = 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 diff --git a/src/Views.elm b/src/Views.elm --- a/src/Views.elm +++ b/src/Views.elm @@ -33,10 +33,12 @@ orange = rgb255 255 153 0 + yellow : Color yellow = rgb255 255 255 0 + red : Color red = rgb255 230 74 69 @@ -118,12 +120,11 @@ drawSquare sq n = let attrs = - List.append [ width <| px n, height <| px n, Font.size 10, Font.center] color + List.append [ width <| px n, height <| px n, Font.size 10, Font.center ] color - ( color, optionalMega) = + ( color, optionalMega ) = squareToColor sq - content = case optionalMega of Nothing -> @@ -135,21 +136,28 @@ el attrs content + --squareToColor : Square -> List (Element.Attr) squareToColor sq = let incompleteReqs flavor = - [ Background.color grey, Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing] + [ Background.color grey, Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing ] completeReqs flavor = - [ Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing] + [ Border.width 1, Border.color flavor.borderColor, toBorderType flavor.scrapped, Font.color flavor.interruptedProcessing ] - reqs flavor = case flavor.squareFilling of - Black -> incompleteReqs flavor -- .borderColor flavor.scrapped - White -> completeReqs flavor -- .borderColor flavor.scrapped + reqs flavor = + case flavor.squareFilling of + Black -> + incompleteReqs flavor + -- .borderColor flavor.scrapped + White -> + completeReqs flavor + + -- .borderColor flavor.scrapped optionalMega x = case x of Normal -> @@ -160,11 +168,12 @@ in case sq of RealSquare params -> - ( reqs params.flavor, optionalMega params.variant) + ( reqs params.flavor, optionalMega params.variant ) PhantomSquare -> ( [], Nothing ) - + + drawLineSquares : Int -> Int -> List (Element Msg) drawLineSquares lines perLine = List.repeat lines (drawSquareFullN perLine) @@ -214,7 +223,7 @@ type Square - = RealSquare {variant: SquareVariant, flavor: VisualFlavor} + = RealSquare { variant : SquareVariant, flavor : VisualFlavor } | PhantomSquare @@ -270,6 +279,8 @@ in 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 @@ -308,13 +319,24 @@ False -> Border.solid + toFontColor : Bool -> Color -toFontColor x = if x then yellow else black +toFontColor x = + if x then + yellow + + else + black -type alias VisualFlavor = {squareFilling : SquareFilling, borderColor : BorderColor, scrapped : Bool, interruptedProcessing : Color} + +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} +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 isSet nrc j = @@ -335,14 +357,16 @@ List.map (\( x, ys ) -> ( toVisualFlavor <| .conditions x, (\z -> z + 1) <| List.length ys )) groups perGroup ( flavor, n ) = - List.concatMap (\( batchSize, batchCount ) -> List.repeat batchCount <| RealSquare {variant = Mega batchSize, flavor = flavor}) <| simplifyNumber smaller5 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 ) @@ -682,13 +706,11 @@ line t (String.fromFloat a) (String.fromFloat b) c - -- TODO: make chartingmodel dynamic to each chart (is now one for all), i.e. pipe in dedicated chartmodel for each chart (that needs to be stored in master model) - -viewChart : List DoneData -> ChartingModel -> Element Msg -viewChart dd cm = - el [ height fill, width fill, Border.width 1, Border.solid, Border.color black ] << Element.html << Html.map (ChartingMsgWrapper cm.chartType) <| Charting.twoLinesChart cm dd +viewChart : List DoneData -> ChartingModel -> List (Round, Round) -> Element Msg +viewChart dd cm kitForNkitStates = + el [ height fill, width fill, Border.width 1, Border.solid, Border.color black ] << Element.html << Html.map (ChartingMsgWrapper cm.chartType) <| Charting.twoLinesChart cm dd kitForNkitStates viewScatter : Model -> Mode -> Element Msg