module Web.View.PatternPerformance.Index where import Web.View.Prelude data IndexView = IndexView { records :: ![PatternPerformanceRecord] , hubs :: ![Hub] } instance View IndexView where html IndexView { .. } = [hsx|

Pattern Performance

{forEach hubs renderRecomputeButton}
{forM_ records renderRow}
Rank Pattern Adoptions Positive / Total Positive Rate Mean Value
|] where renderRow r = let rate = if r.totalOutcomeCount > 0 then fromIntegral r.positiveOutcomeCount / fromIntegral r.totalOutcomeCount :: Double else 0.0 rankLabel = maybe "-" show r.outcomeRank in [hsx| {rankLabel} {show r.widgetPatternId} {show r.adoptionCount} {show r.positiveOutcomeCount}/{show r.totalOutcomeCount} {show (round (rate * 100) :: Int)}% {maybe "-" show r.meanOutcomeValue} |] renderRecomputeButton :: Hub -> Html renderRecomputeButton h = [hsx|
{csrfTokenTag}
|]