summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Election.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Election.hs b/src/Election.hs
index e97eb69..60fd78f 100644
--- a/src/Election.hs
+++ b/src/Election.hs
@@ -280,9 +280,11 @@ addToTransferMap counter mapKeys transferMap traceToAdd = do
let newTraces = map (addToTrace traceToAdd) mapKeys
keyed = zip mapKeys newTraces
noDupes = filter (not . criteriaHasDupe . getCriteria . snd) keyed
- counted <- mapM (\(k,t) -> Sen.doCount counter (getCriteria t) >>= (\x -> return (k,[(x,t)]))) noDupes
- let noZeros = filter ((/= 0) . fst . head . snd) counted
- return (Map.unionWith (++) transferMap (Map.fromList noZeros))
+ counted <- mapM (\(k,t) -> Sen.doCount counter (getCriteria t) >>= (\x -> return (k,(x,t)))) noDupes
+ let notZero (k,xt) = floor ((fromIntegral (fst xt)) * getTransferVal (snd xt)) > 0
+ noZeroMap = filter notZero counted
+ listed = map (\(k,xt) -> (k,xt:[])) noZeroMap
+ return (Map.unionWith (++) transferMap (Map.fromList listed))