var status = require('game').status;

module.exports = {
  createdByMe: function(ctrl) {
    return ctrl.userId && ctrl.userId === ctrl.data.createdBy;
  },
  containsMe: function(ctrl) {
    return ctrl.userId && ctrl.data.players.filter(function(p) {
      return p.name.toLowerCase() === ctrl.userId && !p.withdraw;
    }).length > 0;
  },
  myCurrentPairing: function(ctrl) {
    if (!ctrl.userId) return null;
    return ctrl.data.pairings.filter(function(p) {
      return p.status < status.ids.mate && (
        p.user1.toLowerCase() === ctrl.userId || p.user2.toLowerCase() === ctrl.userId
      );
    })[0];
  }
};

@@ -515,19 +515,16 @@
      p.u
-ser
 1.toLowe
@@ -553,19 +553,16 @@
 d %7C%7C p.u
-ser
 2.toLowe

fix tournament current game warning, even more