From 4834698d80bb421c4024ee78fa4debb2e2cd3617 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Thu, 25 Aug 2016 09:04:14 +0200
Subject: [PATCH] - Fix date pattern in EN locale - Fix JS hint

---
 www/i18n/locale-en.json                       |  2 +-
 www/js/app.js                                 |  2 +-
 www/js/config.js                              |  4 +-
 www/js/controllers/currency-controllers.js    | 48 +++++++++----------
 www/js/services/bma-services.js               |  4 +-
 www/js/services/http-services.js              | 13 +++--
 www/js/services/network-services.js           | 13 ++---
 www/js/services/wallet-services.js            | 22 ++++-----
 .../es/js/controllers/market-controllers.js   | 30 ++++++------
 9 files changed, 64 insertions(+), 74 deletions(-)

diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json
index 5393dbf99..b44dd9051 100644
--- a/www/i18n/locale-en.json
+++ b/www/i18n/locale-en.json
@@ -30,7 +30,7 @@
     "LANGUAGE": "Language",
     "UNIVERSAL_DIVIDEND": "Universal dividend",
     "UD": "UD",
-    "DATE_PATTERN": "YYYY-MM-DD HH:mm",
+    "DATE_PATTERN": "MM/DD/YYYY HH:mm",
     "EMPTY_PARENTHESIS": "(empty)",
     "UID": "Pseudonym",
     "ENABLE": "Enable",
diff --git a/www/js/app.js b/www/js/app.js
index 8dffcf983..dc9be0b47 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -210,7 +210,7 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate',
     $translate('COMMON.DATE_PATTERN')
       .then(function(datePattern) {
         $rootScope.datePattern = datePattern;
-      })
+      });
   };
 
   // Set up moment translation
diff --git a/www/js/config.js b/www/js/config.js
index 255faaaba..a5685437d 100644
--- a/www/js/config.js
+++ b/www/js/config.js
@@ -28,8 +28,8 @@ angular.module("cesium.config", [])
 			"port": "9203"
 		}
 	},
-	"version": "0.2.5",
-	"build": "2016-08-24T17:33:24.544Z",
+	"version": "0.2.6",
+	"build": "2016-08-25T06:51:00.355Z",
 	"newIssueUrl": "https://github.com/duniter/cesium/issues/new?labels=bug"
 })
 
diff --git a/www/js/controllers/currency-controllers.js b/www/js/controllers/currency-controllers.js
index e10bb250a..582512381 100644
--- a/www/js/controllers/currency-controllers.js
+++ b/www/js/controllers/currency-controllers.js
@@ -211,31 +211,31 @@ function CurrencyViewController($scope, $q, $translate, $timeout, BMA, UIUtils,
     ])
 
     // Done
-      .then(function(){
-        var Mprev = M - $scope.currentUD * $scope.Nprev; // remove fresh money
-        var MoverN = Mprev / $scope.Nprev;
-        $scope.cactual = 100 * $scope.currentUD / MoverN;
-
-        if ($scope.formData.useRelative) {
-          $scope.M = Mprev / $scope.currentUD;
-          $scope.MoverN = MoverN / $scope.currentUD;
-          $scope.UD = 1;
-        } else {
-          $scope.M = Mprev;
-          $scope.MoverN = MoverN;
-          $scope.UD = $scope.currentUD;
-        }
-        // Set Ink
-        UIUtils.ink({selector: '.peer-item'});
+    .then(function(){
+      var Mprev = M - $scope.currentUD * $scope.Nprev; // remove fresh money
+      var MoverN = Mprev / $scope.Nprev;
+      $scope.cactual = 100 * $scope.currentUD / MoverN;
+
+      if ($scope.formData.useRelative) {
+        $scope.M = Mprev / $scope.currentUD;
+        $scope.MoverN = MoverN / $scope.currentUD;
+        $scope.UD = 1;
+      } else {
+        $scope.M = Mprev;
+        $scope.MoverN = MoverN;
+        $scope.UD = $scope.currentUD;
+      }
+      // Set Ink
+      UIUtils.ink({selector: '.peer-item'});
 
-        $scope.loading = false;
+      $scope.loading = false;
 
-        UIUtils.loading.hide();
-      })
-      .catch(function(err) {
-        $scope.loading = false;
-        UIUtils.onError('ERROR.LOAD_NODE_DATA_FAILED')(err);
-      })
+      UIUtils.loading.hide();
+    })
+    .catch(function(err) {
+      $scope.loading = false;
+      UIUtils.onError('ERROR.LOAD_NODE_DATA_FAILED')(err);
+    });
   };
 
   $scope.refresh = function() {
@@ -254,7 +254,7 @@ function CurrencyViewController($scope, $q, $translate, $timeout, BMA, UIUtils,
           $scope.loadingPeers = false;
         });
     });
-  }
+  };
 
   $scope.onUseRelativeChanged = function() {
     if ($scope.loading) return;
diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js
index c03ed7fad..9e49fd552 100644
--- a/www/js/services/bma-services.js
+++ b/www/js/services/bma-services.js
@@ -67,10 +67,10 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce
               pubkey: pubkey,
               uid: (uid ? uid : null)
             };
-        })
+        });
     }
 
-    var getBlockchainWithUd = csHttp.getWithCache(host, port, '/blockchain/with/ud', csHttp.cache.SHORT)
+    var getBlockchainWithUd = csHttp.getWithCache(host, port, '/blockchain/with/ud', csHttp.cache.SHORT);
     var getBlockchainBlock = csHttp.getWithCache(host, port, '/blockchain/block/:block', csHttp.cache.SHORT);
 
     function getBlockchainLastUd() {
diff --git a/www/js/services/http-services.js b/www/js/services/http-services.js
index d044974d8..54b44dae4 100644
--- a/www/js/services/http-services.js
+++ b/www/js/services/http-services.js
@@ -92,9 +92,9 @@ angular.module('cesium.http.services', ['ngResource', 'angular-cache'])
             maxAge: maxAge,
             deleteOnExpire: 'aggressive',
             recycleFreq: Math.max(maxAge - 1000, 5 * 60 * 1000 /*5min*/),
-            storageMode:
+            storageMode: 'memory'
               // FIXME : enable this when cache is cleaning on rollback
-              csSettings.data.useLocalStorage ? 'localStorage' : 'memory'
+              //csSettings.data.useLocalStorage ? 'localStorage' : 'memory'
           });
       }
       else {
@@ -107,9 +107,9 @@ angular.module('cesium.http.services', ['ngResource', 'angular-cache'])
             deleteOnExpire: 'aggressive',
             recycleFreq: maxAge,
             onExpire: onExpire,
-            storageMode:
+            storageMode: 'memory'
               // FIXME : enable this when cache is cleaning on rollback
-              csSettings.data.useLocalStorage ? 'localStorage' : 'memory'
+              //csSettings.data.useLocalStorage ? 'localStorage' : 'memory'
           });
       }
     }
@@ -123,7 +123,7 @@ angular.module('cesium.http.services', ['ngResource', 'angular-cache'])
         return $q(function(resolve, reject) {
           var config = {
             timeout: timeout
-          }
+          };
           if (autoRefresh) { // redo the request if need
             config.cache = getOrCreateCache(maxAge, function (key, value) {
                 console.debug('[http] Refreshing cache for ['+key+'] ');
@@ -135,8 +135,7 @@ angular.module('cesium.http.services', ['ngResource', 'angular-cache'])
           }
           else {
             config.cache = getOrCreateCache(maxAge);
-          };
-
+          }
 
           prepare(url, params, config, function(url, config) {
             $http.get(url, config)
diff --git a/www/js/services/network-services.js b/www/js/services/network-services.js
index f497dc094..7fd749414 100644
--- a/www/js/services/network-services.js
+++ b/www/js/services/network-services.js
@@ -196,7 +196,7 @@ angular.module('cesium.network.services', ['ngResource', 'ngApi', 'cesium.bma.se
           processPeer(peer);
           if (!data.updatingPeers) {
             sortPeers();
-          };
+          }
         });
       },
 
@@ -211,20 +211,13 @@ angular.module('cesium.network.services', ['ngResource', 'ngApi', 'cesium.bma.se
             .then(function(peers){
               resolve(peers);
               console.debug('[network] Started in '+(new Date().getTime() - now.getTime())+'ms');
-            })
+            });
         });
-
-        // Add a destroy hook
-        if ($scope) {
-          $scope.$on('$destroy', function(){
-            close();
-          });
-        }
       },
 
       close = function() {
         if (data.bma) {
-          console.info('[network] Close');
+          console.info('[network] Stopping');
           data.bma.websocket.close();
           resetData();
         }
diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js
index cd0c792c6..dd61879a6 100644
--- a/www/js/services/wallet-services.js
+++ b/www/js/services/wallet-services.js
@@ -362,31 +362,29 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser
         var fromTime = nowInSec - csSettings.data.walletHistoryTimeSecond;
         var processedTxMap = {};
 
+        var reduceTx = function(res){
+          reduceTxAndPush(res.history.sent, txHistory, processedTxMap, true/*exclude pending*/);
+          reduceTxAndPush(res.history.received, txHistory, processedTxMap, true/*exclude pending*/);
+          reduceTxAndPush(res.history.sending, txHistory, processedTxMap, true/*exclude pending*/);
+          reduceTxAndPush(res.history.pending, txPendings, processedTxMap, false/*exclude pending*/);
+        };
+
         var jobs = [
           // get pendings history
           BMA.tx.history.pending({pubkey: data.pubkey})
-            .then(function(res){
-              reduceTxAndPush(res.history.sending, txHistory, processedTxMap, true/*exclude pending*/);
-              reduceTxAndPush(res.history.pending, txPendings, processedTxMap, false/*exclude pending*/);
-            })
+            .then(reduceTx)
         ];
 
         // get TX history since
         var sliceTime = csSettings.data.walletHistorySliceSecond;
         for(var i = fromTime - (fromTime % sliceTime); i - sliceTime < nowInSec; i += sliceTime)  {
           jobs.push(BMA.tx.history.times({pubkey: data.pubkey, from: i, to: i+sliceTime-1})
-            .then(function(res){
-              reduceTxAndPush(res.history.sent, txHistory, processedTxMap, true/*exclude pending*/);
-              reduceTxAndPush(res.history.received, txHistory, processedTxMap, true/*exclude pending*/);
-            })
+            .then(reduceTx)
           );
         }
 
         jobs.push(BMA.tx.history.timesNoCache({pubkey: data.pubkey, from: nowInSec - (nowInSec % sliceTime), to: nowInSec+999999999})
-          .then(function(res){
-            reduceTxAndPush(res.history.sent, txHistory, processedTxMap, true/*exclude pending*/);
-            reduceTxAndPush(res.history.received, txHistory, processedTxMap, true/*exclude pending*/);
-          }));
+          .then(reduceTx));
 
         // get UD history
         if (csSettings.data.showUDHistory) {
diff --git a/www/plugins/es/js/controllers/market-controllers.js b/www/plugins/es/js/controllers/market-controllers.js
index 6747be3d5..a4940c215 100644
--- a/www/plugins/es/js/controllers/market-controllers.js
+++ b/www/plugins/es/js/controllers/market-controllers.js
@@ -414,21 +414,21 @@ function ESMarketRecordViewController($scope, $rootScope, Wallet, esMarket, UIUt
       }
     });
 
-  // Continue loading other data
-  $q.all([
-    // Load pictures
-    esMarket.record.picture.all({id: id})
-      .then(function (hit) {
-        if (hit._source.pictures) {
-          $scope.pictures = hit._source.pictures.reduce(function (res, pic) {
-            return res.concat(UIUtils.image.fromAttachment(pic.file));
-          }, []);
-        }
-      }),
+    // Continue loading other data
+    $q.all([
+      // Load pictures
+      esMarket.record.picture.all({id: id})
+        .then(function (hit) {
+          if (hit._source.pictures) {
+            $scope.pictures = hit._source.pictures.reduce(function (res, pic) {
+              return res.concat(UIUtils.image.fromAttachment(pic.file));
+            }, []);
+          }
+        }),
 
-    // Load comments
-    $scope.loadComments(id)
-  ])
+      // Load comments
+      $scope.loadComments(id)
+    ])
     .then(function () {
       // Set Motion
       $timeout(function () {
@@ -441,7 +441,7 @@ function ESMarketRecordViewController($scope, $rootScope, Wallet, esMarket, UIUt
       $scope.pictures = [];
       $scope.comments = [];
     });
-  }
+  };
 
   $scope.refreshConvertedPrice = function() {
     if (!$scope.formData.price) {
-- 
GitLab