From 9b74b03ee3e082449e556c71e9e275b1d102cf68 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Mon, 13 Mar 2017 14:56:41 +0100
Subject: [PATCH] fix #380

---
 www/i18n/locale-en-GB.json                   |  5 +++
 www/i18n/locale-en.json                      |  5 +++
 www/i18n/locale-fr-FR.json                   |  7 +++-
 www/js/config.js                             |  2 +-
 www/js/controllers/currency-controllers.js   | 11 ++++-
 www/templates/currency/items_parameters.html | 43 ++++++++++++++++++--
 6 files changed, 66 insertions(+), 7 deletions(-)

diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json
index 55ab7c690..69b1526a3 100644
--- a/www/i18n/locale-en-GB.json
+++ b/www/i18n/locale-en-GB.json
@@ -35,6 +35,7 @@
     "BTN_OPTIONS": "Options",
     "BTN_HELP_TOUR": "Features tour",
     "BTN_HELP_TOUR_SCREEN": "Discover this screen",
+    "DAYS": "days",
     "NO_ACCOUNT_QUESTION": "Not a member yet? Register now!",
     "SEARCH_NO_RESULT": "No result found",
     "LOADING": "Loading...",
@@ -195,6 +196,10 @@
       "MONEY_RULES_DIVIDER": "Rules of currency",
       "C_RULE": "Growth",
       "UD_RULE": "Universal dividend (formula)",
+      "DT_REEVAL": "Period between two re-evaluation of the UD",
+      "REEVAL_SYMBOL": "reeval",
+      "DT_REEVAL_VALUE": "Every <b>{{dtReeval|formatDuration}}</b> ({{dtReeval/86400}} {{'COMMON.DAYS'|translate}})",
+      "UD_REEVAL_TIME0": "Date of first reevaluation of the UD",
       "SIG_QTY_RULE": "Required number of certifications to become a member",
       "SIG_STOCK": "Maximum number of certifications sent by a member",
       "SIG_PERIOD": "Minimum delay between 2 certifications sent by one and the same issuer.",
diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json
index 1d878e1a4..81c8517ad 100644
--- a/www/i18n/locale-en.json
+++ b/www/i18n/locale-en.json
@@ -35,6 +35,7 @@
     "BTN_OPTIONS": "Options",
     "BTN_HELP_TOUR": "Features tour",
     "BTN_HELP_TOUR_SCREEN": "Discover this screen",
+    "DAYS": "days",
     "NO_ACCOUNT_QUESTION": "Not a member yet? Register now!",
     "SEARCH_NO_RESULT": "No result found",
     "LOADING": "Loading...",
@@ -195,6 +196,10 @@
       "MONEY_RULES_DIVIDER": "Rules of currency",
       "C_RULE": "Growth",
       "UD_RULE": "Universal dividend (formula)",
+      "DT_REEVAL": "Period between two re-evaluation of the UD",
+      "REEVAL_SYMBOL": "reeval",
+      "DT_REEVAL_VALUE": "Every <b>{{dtReeval|formatDuration}}</b> ({{dtReeval/86400}} {{'COMMON.DAYS'|translate}})",
+      "UD_REEVAL_TIME0": "Date of first reevaluation of the UD",
       "SIG_QTY_RULE": "Required number of certifications to become a member",
       "SIG_STOCK": "Maximum number of certifications sent by a member",
       "SIG_PERIOD": "Minimum delay between 2 certifications sent by one and the same issuer.",
diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json
index 6e59b4a62..07a2fb2ae 100644
--- a/www/i18n/locale-fr-FR.json
+++ b/www/i18n/locale-fr-FR.json
@@ -35,6 +35,7 @@
     "BTN_OPTIONS": "Options",
     "BTN_HELP_TOUR": "Visite guidée",
     "BTN_HELP_TOUR_SCREEN": "Découvrir cet écran",
+    "DAYS": "jours",
     "NO_ACCOUNT_QUESTION": "Pas de encore membre ? Créer un compte !",
     "SEARCH_NO_RESULT": "Aucun résultat trouvé",
     "LOADING": "Veuillez patienter...",
@@ -194,7 +195,11 @@
       "POW_MIN": "Niveau minimal de difficulté de calcul",
       "MONEY_RULES_DIVIDER": "Règles de la monnaie",
       "C_RULE": "Croissance théorique",
-      "UD_RULE": "Dividende universel (formule)",
+      "UD_RULE": "Calcul du dividende universel",
+      "DT_REEVAL": "Période de revalorisation du DU",
+      "REEVAL_SYMBOL": "reval",
+      "DT_REEVAL_VALUE": "Tous les <b>{{dtReeval|formatDuration}}</b> ({{dtReeval/86400}} {{'COMMON.DAYS'|translate}})",
+      "UD_REEVAL_TIME0": "Date de la 1ère revalorisation",
       "SIG_QTY_RULE": "Nombre de certifications requises pour devenir membre",
       "SIG_STOCK": "Nombre maximal de certifications émises par membre",
       "SIG_PERIOD": "Délai minimal d'attente entre 2 certifications successives émises par une même personne",
diff --git a/www/js/config.js b/www/js/config.js
index 7e3d5ab7b..e4d2aa982 100644
--- a/www/js/config.js
+++ b/www/js/config.js
@@ -45,7 +45,7 @@ angular.module("cesium.config", [])
 		}
 	},
 	"version": "0.11.3",
-	"build": "2017-03-10T12:21:33.425Z",
+	"build": "2017-03-13T13:44:59.007Z",
 	"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 4ac0a9d3a..48760e21d 100644
--- a/www/js/controllers/currency-controllers.js
+++ b/www/js/controllers/currency-controllers.js
@@ -191,7 +191,8 @@ function CurrencyViewController($scope, $q, $timeout, BMA, UIUtils, csSettings,
     xpercent: 0,
     durationFromLastUD: 0,
     blockUid: null,
-    peerCount: 0
+    dtReeval: 0,
+    udReevalTime0: 0
   };
   $scope.node = null;
   $scope.loading = true;
@@ -259,6 +260,14 @@ function CurrencyViewController($scope, $q, $timeout, BMA, UIUtils, csSettings,
           data.stepMax = json.stepMax;
           data.xpercent = json.xpercent;
           data.avgGenTime = json.avgGenTime;
+          data.dtReeval = json.dtReeval;
+          data.udTime0 = json.udTime0;
+          data.udReevalTime0 = json.udReevalTime0;
+
+          // Compat with Duniter < 1.0
+          if (!data.dtReeval) {
+            data.dtReeval = data.dt;
+          }
         }),
 
       // Get the current block informations
diff --git a/www/templates/currency/items_parameters.html b/www/templates/currency/items_parameters.html
index 09d762a30..0d5748a05 100644
--- a/www/templates/currency/items_parameters.html
+++ b/www/templates/currency/items_parameters.html
@@ -80,13 +80,48 @@
       <span translate>CURRENCY.VIEW.C_RULE</span>
       <span class="gray">(c)</span>
     </div>
-    <span class="badge badge-stable" ng-if="!loading">{{formData.c*100 | formatNumeral: '0,0.00'}} %&nbsp;/&nbsp;{{formData.dt | formatPeriod}}</span>
+    <!-- compat with Duniter 0.90 -->
+    <span class="item-note dark" ng-if="!loading && !formData.udReevalTime0">{{formData.c*100 | formatNumeral: '0,0.00'}} %&nbsp;/&nbsp;{{formData.dt | formatPeriod}}</span>
+    <!-- Duniter 1.0+ -->
+    <span class="item-note dark" ng-if="!loading && formData.udReevalTime0">{{formData.c*100 | formatNumeral: '0,0.00'}} %&nbsp;/&nbsp;{{formData.dtReeval | formatDuration}}</span>
+  </ion-item>
+
+  <!-- only Duniter 1.0+ -->
+  <ion-item class="item-icon-left item-text-wrap" ng-if="formData.udReevalTime0">
+    <i class="icon ion-load-c"></i>
+    <b class="ion-clock icon-secondary" style="font-size: 18px; left: 36px; top: -12px;"></b>
+    <div class="col col-60">
+      <span translate>CURRENCY.VIEW.DT_REEVAL</span>
+      <span class="gray">(dt<sub>{{'CURRENCY.VIEW.REEVAL_SYMBOL'|translate}}</sub>)</span>
+    </div>
+    <span class="item-note dark" ng-if="!loading"
+          translate="CURRENCY.VIEW.DT_REEVAL_VALUE"
+          translate-values="formData">
+    </span>
+  </ion-item>
+
+  <!-- only Duniter 1.0+ -->
+  <ion-item class="item-icon-left item-text-wrap" ng-if="formData.udReevalTime0">
+    <i class="icon ion-load-c"></i>
+    <b class="ion-calendar icon-secondary" style="font-size: 18px; left: 36px; top: -12px;"></b>
+    <div class="col col-60">
+      <span translate>CURRENCY.VIEW.UD_REEVAL_TIME0</span>
+      <span class="gray">(t0<sub>{{'CURRENCY.VIEW.REEVAL_SYMBOL'|translate}}</sub>)</span>
+    </div>
+    <span class="item-note dark" ng-if="!loading">{{formData.udReevalTime0|formatDate}}
+    </span>
   </ion-item>
 
   <ion-item  class="item-icon-left item-text-wrap">
-      <i class="icon ion-load-c"></i>
-      <span class="col col-60" translate>CURRENCY.VIEW.UD_RULE</span>
-      <span class="item-note dark" ng-if="!loading">{{'COMMON.UD'|translate}}<sub>t-1</sub> + c<sup>2</sup> * M<sub>t-1</sub>/N<sub>t-1</sub></span>
+    <i class="icon ion-load-c"></i>
+    <div class="col col-60">
+      <span translate>CURRENCY.VIEW.UD_RULE</span>
+      <span class="gray" ng-if="formData.udReevalTime0">- {{'COMMON.UD'|translate}}<sub>{{formData.dt|formatPeriod}}</sub>(t<sub>{{'CURRENCY.VIEW.REEVAL_SYMBOL'|translate}}</sub>)</span>
+    </div>
+    <!-- compat with Duniter 0.90 -->
+    <span class="item-note dark" ng-if="!loading && !formData.udReevalTime0">{{'COMMON.UD'|translate}}<sub>t-1</sub> + c<sup>2</sup> * M<sub>t-1</sub>/N<sub>t-1</sub></span>
+    <!-- Duniter 1.0+ -->
+    <span class="item-note dark" ng-if="!loading && formData.udReevalTime0">{{'COMMON.UD'|translate}}<sub>{{formData.dt|formatPeriod}}</sub>(t<sub>{{'CURRENCY.VIEW.REEVAL_SYMBOL'|translate}}</sub> - dt<sub>{{'CURRENCY.VIEW.REEVAL_SYMBOL'|translate}}</sub>)+ c<sup>2</sup> * (M/N)(t<sub>{{'CURRENCY.VIEW.REEVAL_SYMBOL'|translate}}</sub> - dt<sub>{{'CURRENCY.VIEW.REEVAL_SYMBOL'|translate}}</sub>) / dt<sub>{{'CURRENCY.VIEW.REEVAL_SYMBOL'|translate}}</sub></span>
   </ion-item>
 
 </div>
-- 
GitLab