Skip to content

Commit

Permalink
reset master to start excercise start point
Browse files Browse the repository at this point in the history
  • Loading branch information
raimohanska committed Feb 1, 2012
1 parent defeb73 commit 1448e58
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/BeerCounter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,4 @@ buyRound = method POST $ catchError "Internal Error" $ do
karma = method GET $ catchError "Internal Error" $ do
me <- requiredParam "me"
other <- requiredParam "other"
rounds <- liftIO $ mongoFindAll beerDB roundCollection :: Snap [Round]
writeLBS $ UTF8.fromString $ show $ relativeKarma me other rounds


relativeKarma :: String -> String -> [Round] -> Int
relativeKarma me other [] = 0
relativeKarma me other (e:es) = eventKarma e + relativeKarma me other es
where eventKarma (Round me others) | elem other others = 1
eventKarma (Round other others) | elem me others = -1
eventKarma _ = 0
writeLBS $ UTF8.fromString $ "lol!"

0 comments on commit 1448e58

Please sign in to comment.