 
       Challenges.update currentChallenge()._id, $set: { notified: true }
 
-      return
+      console.log "break"
+      return false
+
+  challenges.rewind()
 
   # check for challenges
-  for c in challenges
-    continue unless c.challengeeId is currentPlayerId()
+  challenges.forEach (c) ->
+    console.log "check challenge: #{c}"
+    unless c.challengeeId is currentPlayerId()
+      console.log 'continue'
+      return true
 
     challengerGame = Games.findOne c.challengerGameId
     challengeeGame = Games.findOne c.challengeeGameId

        cancel:  "Nei takk"
        confirm: "Aksepter dyst"

      return

startGame = ({challengeeId, acceptChallengeId}) ->
  Meteor.call 'newGame', currentPlayerId(),

    'disabled' unless currentPlayer()?

  challenge: ->
    console.log 'challenge helper'
    challenges = Challenges.find $or: [
      { challengerId: currentPlayerId() }
    , { challengeeId: currentPlayerId() }
    ]
    if challenges.count() > 0
      checkChallenges challenges

Template.players.helpers
  onlinePlayers: onlinePlayers
