 
       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

# methods

checkChallenges = (challenges) ->
  # check for results
  for c in challenges
    continue unless c.challengerId is currentPlayerId()

    challengerGame = Games.findOne c.challengerGameId
    challengeeGame = Games.findOne c.challengeeGameId

    '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
