From 4387327f4c2ce91ecefa7fc45c7b5412aad67d07 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Mon, 30 Jan 2017 15:56:45 +1100 Subject: Fixed off-by-2 bug with constructing SenateCounter object --- src/Counter.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Counter.hs') diff --git a/src/Counter.hs b/src/Counter.hs index 0f3e0d9..bc23671 100644 --- a/src/Counter.hs +++ b/src/Counter.hs @@ -54,12 +54,15 @@ createSenateCounter f a b = do let prefs = parseRawLine a b t0 result = Maybe.fromJust prefs if (Maybe.isJust prefs) - then Vec.setPrefs prefStore n result >> readFunc (n + 1) (p + 1) + then Vec.setPrefs prefStore (p + 1) result >> readFunc (n + 1) (p + 1) else readFunc (n + 1) p p <- readFunc 1 0 IO.hClose h - return (SenateCounter prefStore b p) + return (SenateCounter + { prefData = prefStore + , ballotMap = b + , numBallots = p }) -- cgit