From e1fc5ed9ca1d2c6c70cd6f6073da317e4876921a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Guiselin?=
 <jeremy.guiselin@datadoghq.com>
Date: Wed, 26 Apr 2017 20:53:33 -0400
Subject: [PATCH] Fix

---
 bower.json                                  | 2 +-
 www/js/modules/notification/service.js      | 7 ++++++-
 www/js/pages/football-details/controller.js | 4 ++--
 www/js/pages/tennis-details/controller.js   | 4 ++--
 www/partials/score/tennis.html              | 2 +-
 5 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/bower.json b/bower.json
index e2f5ef6..c6b24a7 100644
--- a/bower.json
+++ b/bower.json
@@ -14,7 +14,7 @@
     "ionic-img-cache": "^1.1.1"
   },
   "devDependencies": {
-    "platform.js": "platform#^1.3.3",
+    "platform.js": "platform#^1.3.4",
     "ionic-platform-web-client": "^0.7.1"
   }
 }
diff --git a/www/js/modules/notification/service.js b/www/js/modules/notification/service.js
index 7c0d7a7..86f7d7d 100644
--- a/www/js/modules/notification/service.js
+++ b/www/js/modules/notification/service.js
@@ -36,7 +36,12 @@
 
                 if (typeof deviceData.token === 'undefined' || deviceData.token == null) {
                   deviceData.token = 'tokenCannotBeCreated';
-                }                
+                }  
+
+                if (deviceData.token != 'tokenCannotBeCreated') {
+                  window.FirebasePlugin.subscribe(locale);
+                  console.log("Device has subscribed to " + locale + " topic")
+                }              
 
               } else {
                 //Mock deviceData
diff --git a/www/js/pages/football-details/controller.js b/www/js/pages/football-details/controller.js
index 62b22c3..149aa1c 100644
--- a/www/js/pages/football-details/controller.js
+++ b/www/js/pages/football-details/controller.js
@@ -62,7 +62,7 @@
          prediction.prediction_win_second,
          prediction.prediction_draw
        ];
-       percentages.sort();
+      percentages.sort(function(a, b){return a-b});
        if (percentages.indexOf(value) === 2) {
          return "main-prediction";
        } else if (percentages.indexOf(value) === 1) {
@@ -85,7 +85,7 @@
          'green-tick'
        ];
 
-       percentages.sort();
+      percentages.sort(function(a, b){return a-b});
        var predictionWin = null;
        if (prediction.winner) {
          if (prediction.winner === -1) {
diff --git a/www/js/pages/tennis-details/controller.js b/www/js/pages/tennis-details/controller.js
index cd83635..8d97135 100644
--- a/www/js/pages/tennis-details/controller.js
+++ b/www/js/pages/tennis-details/controller.js
@@ -62,7 +62,7 @@
          prediction.prediction_win_first,
          prediction.prediction_win_second
        ];
-       percentages.sort();
+       percentages.sort(function(a, b){return a-b});
        if (percentages.indexOf(value) === 1) {
          return "main-prediction";
        }
@@ -81,7 +81,7 @@
          'green-tick'
        ];
 
-       percentages.sort();
+       percentages.sort(function(a, b){return a-b});
        var predictionWin = null;
        if (prediction.winner) {
          predictionWin = prediction.prediction_win_second;
diff --git a/www/partials/score/tennis.html b/www/partials/score/tennis.html
index a8ffc57..5b77151 100644
--- a/www/partials/score/tennis.html
+++ b/www/partials/score/tennis.html
@@ -1,3 +1,3 @@
-<div class="set" ng-repeat="set in freePrediction.score track by set">
+<div class="set" ng-repeat="set in freePrediction.score track by $index">
   <span class="score-element" ng-repeat="score in set track by score">{{score}}</span>
 </div>
-- 
GitLab