 window.FootballPickService = class FootballPickService
     constructor: (@$http, @$timeout, @$q) ->
         @picks              = {}
-        @queuedPickChanges  = {}
+        @queuedPickChanges  = []
         @queueTimeout       = null
 
 

            true
        )

    preparePick: (data, picksArray) ->
        pick = picksArray.pop()
        data.fantasy_picks[pick.game_id] = pick.team_id







    changePick: (game, player, team) ->
        @queuedPickChanges.push
            game_id: game.game_id
            team_id: team.team_id
        @$timeout.cancel(@queueTimeout) if @queueTimeout
        @queueTimeout = @$timeout(
            () =>
                picksHash = {}
                while @queuedPickChanges.length
                    pick = @queuedPickChanges.pop()
                    picksHash[pick.game_id] = pick.team_id

                data = {fantasy_picks: picksHash}
                @$http.post("/api/v1.0/football/fantasy-picks/", data)
                    .success((response) =>
                        console.log(response)
