title: Parse push notifications specific users Cloud Code
body: <p>Currently I am trying to add push notifications to my app, specifically a push notification to two different users which is triggered by a third user.</p>
  
  <p>The cloud code below works fine except for the fact that push notifications aren't working.  I want two push notifications set to both the winner and loser users when this function is triggered client side by the third user.</p>
  
  <pre><code>Parse.Cloud.define('addWinsLosses', function(request,response) { 
  
      Parse.Cloud.useMasterKey(); 
  
      var winnerUserId = request.params.winnerUserId;
      var loserUserId = request.params.loserUserId;
  
      var User = Parse.Object.extend('_User');
      var winner = new User({ objectId: winnerUserId });
      var loser = new User({ objectId: loserUserId });
  
      console.log(JSON.stringify(winner));
      console.log(JSON.stringify(loser));
  
      winner.increment('wins');
      loser.increment('losses');
  
      var pushQuery = new Parse.Query(Parse.Installation);
  
      pushQuery.equalTo('user', winner)
  
      Parse.Push.send({
          where: pushQuery
          data: {
              alert: "You Won!",
              badge: "increment"
          }
      }, {
          success: function () {
              response.success();
          },
          error: function (error) {
              response.error(error);
          }
      })
  
      var pushQuery = new Parse.Query(Parse.Installation);
  
      pushQuery.equalTo('user', loser)
  
      Parse.Push.send({
          where: pushQuery
          data: {
              alert: "You lost.",
              badge: 'increment'
          }
      }, {
          success: function () {
              response.success();
          },
          error: function (error) {
              response.error(error);
          }
      })
  
      Parse.Promise.when([winner.save(), loser.save()]).then(function () {
          // both saves have completed
          response.success();
      }, function (error) {
          // one or more errors
          console.log("Error in addWinsLosses : " + error.message);
          response.error(error);
      });
  });
  </code></pre>
  
  <p>I have added the relationship needed:</p>
  
  <pre><code>let installation = PFInstallation.currentInstallation()
              installation["user"] = PFUser.currentUser()
              installation.saveEventually()
  </code></pre>
  
  <p>This should be a pointer to a PFUser which is then compared to another pointer to a PFUser in my cloud code, either "winner" or "loser".  The message is different for the two users.</p>
  
  <p><strong>So a few questions:</strong></p>
  
  <ol>
  <li>What is wrong with my code?</li>
  <li>How can I clean up my code
  starting with combining the "Parse.Push.send"?</li>
  </ol>