summaryrefslogtreecommitdiff
path: root/hledger-overview.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hledger-overview.hs')
-rwxr-xr-xhledger-overview.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/hledger-overview.hs b/hledger-overview.hs
index 6090736..5418059 100755
--- a/hledger-overview.hs
+++ b/hledger-overview.hs
@@ -107,13 +107,22 @@ class Display a where
instance Display Chunk where
display c = c
+-- green = achieved
+-- yellow = within 5% of achieving
+-- red = work to do
instance Display Metric where
display (Target expected actual) = color $ display actual
where
- color = if actual >= expected then fore green else fore red
+ color
+ | actual >= expected = fore green
+ | actual >= (expected * 0.95) = fore yellow
+ | otherwise = fore red
display (Limit expected actual) = color $ display actual
where
- color = if actual <= expected then fore green else fore red
+ color
+ | actual <= expected = fore green
+ | actual <= (expected * 0.95) = fore yellow
+ | otherwise = fore red
-- | Tag numbers for different kinds of displays
data Number