Template._stats.helpers({
  completedBets: function(){
    return Bets.find({ status: "completed" }).count()
  },

  wonBets: function(){
    var user = Session.get("userObject")
    return Bets.find({ $and: [ { status: "completed" }, { winner: user.username }]}).count();
  }
});

Template._stats.helpers({

  statistics: function(){
    var user = Session.get("userObject");

    var completedBets = Bets.find({ status: "completed" }).count();

    var wins = Bets.find({ winner: user}).count();

    var losses = completedBets - wins;

    return [wins, losses]
  }

});

create statistics helper to return wins and losses