diff --git a/Handler/Dashboard.hs b/Handler/Dashboard.hs index 1476799..fd1dc80 100644 --- a/Handler/Dashboard.hs +++ b/Handler/Dashboard.hs @@ -189,10 +189,10 @@ prettyIndicatorEntry entry = prettyTestTitle (entityVal $ indicatorEntryTest ent (entityVal $ indicatorEntryChallenge entry) formatTargets :: IndicatorEntry -> Text -formatTargets = T.intercalate ", " . (map formatTarget) . indicatorEntryTargets +formatTargets entry = T.intercalate ", " $ (map (formatTarget (testPrecision $ entityVal $ indicatorEntryTest entry))) $ indicatorEntryTargets entry -formatTarget :: Entity Target -> Text -formatTarget (Entity _ target) = (T.pack $ show $ targetValue target) <> " (" <> (T.pack $ formatTime defaultTimeLocale "%Y-%m-%d %H:%M" $ targetDeadline target) ++ ")" +formatTarget :: Maybe Int -> Entity Target -> Text +formatTarget mPrecision (Entity _ target) = (formatScore mPrecision (targetValue target)) <> " (" <> (T.pack $ formatTime defaultTimeLocale "%Y-%m-%d %H:%M" $ targetDeadline target) ++ ")" indicatorStatusCell :: Maybe (Entity User) -> Table.Table App IndicatorEntry indicatorStatusCell mUser = Table.widget "" (indicatorStatusCellWidget mUser) diff --git a/Handler/Graph.hs b/Handler/Graph.hs index 89a30a2..d8d9d1a 100644 --- a/Handler/Graph.hs +++ b/Handler/Graph.hs @@ -247,13 +247,13 @@ targetsToLines theNow indicator = object [ "y" .= object [ "lines" .= map (\target -> object [ "value" .= (targetValue $ entityVal target), - "text" .= formatTarget target + "text" .= formatTarget mPrecision target ]) targets ], "x" .= object [ "lines" .= ((map (\target -> object [ "value" .= (formatTimestamp $ targetDeadline $ entityVal target), - "text" .= formatTarget target + "text" .= formatTarget mPrecision target ]) targets) ++ [object [ "value" .= formatTimestamp theNow, @@ -262,6 +262,7 @@ targetsToLines theNow indicator = object [ ] ] where targets = indicatorEntryTargets indicator + mPrecision = testPrecision $ entityVal $ indicatorEntryTest indicator getBound :: (a -> a -> Ordering) -> [a] -> [a] -> Maybe a getBound _ [] _ = Nothing