diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2015-03-22 01:08:32 +0000 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2015-03-22 01:08:32 +0000 |
commit | 64137f8ad81cc3e8dfce7fd9328a214e7c28095d (patch) | |
tree | eadf4e06c30dd33d4ca188f052e32ae1444cbd23 | |
parent | 392d354b8e4802ca8f83129260959bccd5a43aab (diff) | |
download | sariulclocks-64137f8ad81cc3e8dfce7fd9328a214e7c28095d.tar.gz |
don't ever deduct points from a class that hasn't wasted any time
-rw-r--r-- | src/sariulccron.hs | 4 |
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) |