summaryrefslogtreecommitdiff
path: root/src/Election.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Election.hs')
-rw-r--r--src/Election.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Election.hs b/src/Election.hs
index a475f0e..8a0e4d0 100644
--- a/src/Election.hs
+++ b/src/Election.hs
@@ -80,8 +80,8 @@ data Transfer = Transfer
-createElection :: FilePath -> Sen.SenateCounter -> Int -> Bool -> IO Election
-createElection outDir counter numToElect verbosity = do
+createElection :: FilePath -> FilePath -> Sen.SenateCounter -> Int -> Bool -> IO Election
+createElection outDir mainLog counter numToElect verbosity = do
entries <- mapM (candToEntry counter) (Sen.getBallot counter)
return (Election
{ getEntries = entries
@@ -89,7 +89,7 @@ createElection outDir counter numToElect verbosity = do
, getLogDir = outDir
, getTotalPapers = Sen.getTotal counter
, getQuota = droopQuota (Sen.getTotal counter) numToElect
- , getMainLog = outDir ++ "/" ++ "log.txt"
+ , getMainLog = mainLog
, getNextLogNum = 1
, getSeats = numToElect
, getVacancies = numToElect
@@ -360,7 +360,14 @@ excludeCandidates e = do
let v1 = v + i
n1 = n + 1
if (v1 > appliedBreakpoint)
- then n > 0 ? ET.left e $ ET.left r
+ then if (n > 0)
+ then do
+ MIO.liftIO $ Con.when (n > 1) $ do
+ let logmsg = "Bulk exclusion at logfile #" ++ show (getNextLogNum e)
+ IO.appendFile (getMainLog e) (logmsg ++ "\n")
+ Con.when (isVerbose e) (IO.hPutStrLn IO.stderr logmsg)
+ ET.left e
+ else ET.left r
else excludeLoop n1 v1 r
if (length running > 0 && all (< getQuota e) (map getTotalVotes running))