diff options
author | Ben Sima <ben@bsima.me> | 2021-02-17 10:33:47 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2021-02-17 10:33:47 -0500 |
commit | 39f88320df5ae0ae9ceaad33a47d713dbd9c74a2 (patch) | |
tree | 1b4c0dd6b3384d1129bfaecfe5e06330f042bc59 | |
parent | c6a8eba03c84ffa5df13146c71da0dfeb3c921b2 (diff) |
hledger-overview: add yellow for 95% complete metrics
-rwxr-xr-x | hledger-overview.hs | 13 |
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 |