aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2015-03-22 01:08:32 +0000
committerSean Whitton <spwhitton@spwhitton.name>2015-03-22 01:08:32 +0000
commit64137f8ad81cc3e8dfce7fd9328a214e7c28095d (patch)
treeeadf4e06c30dd33d4ca188f052e32ae1444cbd23
parent392d354b8e4802ca8f83129260959bccd5a43aab (diff)
downloadsariulclocks-64137f8ad81cc3e8dfce7fd9328a214e7c28095d.tar.gz
don't ever deduct points from a class that hasn't wasted any time
-rw-r--r--src/sariulccron.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sariulccron.hs b/src/sariulccron.hs
index c45db0a..394909e 100644
--- a/src/sariulccron.hs
+++ b/src/sariulccron.hs
@@ -27,7 +27,9 @@ scoreTimeWasted :: Score -> Int
scoreTimeWasted (Score _ x) = x
deductPoints :: Int -> (Class, Score) -> (Class, Score)
-deductPoints n (c, Score x y) = (c, Score (x - n) y)
+deductPoints n (c, Score x y) = if y > 0
+ then (c, Score (x - n) y)
+ else (c, Score x y)
resetTime :: (Class, Score) -> (Class, Score)
resetTime (c, Score x _) = (c, Score x 0)