Commit 26816c77 authored by Éloïs's avatar Éloïs

Merge branch 'dev2'

parents 6c5b665c 22a803ac
node_modules
yarn.lock
\ No newline at end of file
......@@ -19,28 +19,12 @@ push_to_github:
- bash -c "cat packed-refs | grep -v 'refs/pull' > packed-refs-new; echo 'Removed pull refs.'"
- mv packed-refs-new packed-refs
- bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?"
enforce_readme:
stage: github-sync
variables:
GIT_STRATEGY: none
tags:
- github
script:
- rm -rf ./*
- rm -rf .git
- git clone $GITHUB_URL_AND_KEY .
- git config --global user.email "contact@duniter.org"
- git config --global user.name "Duniter"
- git checkout master
- cat .github/github_disclaimer.md > README.md.new
- cat README.md >> README.md.new
- mv README.md.new README.md
- git commit -am "Enforce github readme"
- git push origin master
publish:
stage: deploy
image: node:6.12-alpine
tags:
- nodejs
only:
- tags
- triggers
......
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Currency-Monit",
"program": "${workspaceRoot}/run.js",
"args": ["currency-monit"]
}
]
}
\ No newline at end of file
LG en
VERSION Version
AUTHOR Author
CONTRIBUTORS Others Contributors
LICENSE license
GIT_REPOSITORY git repository
IF_YOU_WANT If you want you can
DISABLE_HELP disable help
DONATE You can support the development of this module by a gift in Ğ1
\ No newline at end of file
LG fr
VERSION Version
AUTHOR Auteur
CONTRIBUTORS Autres contributeurs
LICENSE licence
GIT_REPOSITORY dépôt git
IF_YOU_WANT Si vous le souhaitez vous pouvez
DISABLE_HELP désactiver l'aide
DONATE Vous pouvez soutenir le développement de ce module par un don en Ğ1
\ No newline at end of file
SUBMIT_BUTTON submit
\ No newline at end of file
SUBMIT_BUTTON submit
WRITTEN_BLOCKS Written blocks
BLOCKCHAIN blockchain
SINCE_BECOME_MEMBER since become member
MEAN_NONCE Mean nonce
RANGE members have written blocks in the range
BEGIN Begin
END End
NB_BLOCKS Number of written Blocks
PERCENT_OF_WRITTEN_BLOCKS Percent of written Blocks
DETAIL_BY_NODE detail by node
SIGNIFICANT_LIMIT significant limit
PERCENT_OF_BLOCKS % of blocks
\ No newline at end of file
SUBMIT_BUTTON recharger
\ No newline at end of file
SUBMIT_BUTTON recharger
WRITTEN_BLOCKS blocs écrits
BLOCKCHAIN blockchain
SINCE_BECOME_MEMBER par chaque membre depuis qu'il est devenu membre
MEAN_NONCE Nonce moyen
RANGE membres ayant écrit des blocs sur la période
BEGIN Début
END Fin
NB_BLOCKS Nombre de blocs écrits
PERCENT_OF_WRITTEN_BLOCKS % de blocs écrits
DETAIL_BY_NODE detail par noeud
SIGNIFICANT_LIMIT noeud significatif à partir de
PERCENT_OF_BLOCKS % de blocs
\ No newline at end of file
SUBMIT_BUTTON submit
DISTRIBUTION_QUALITY gaussian distribution of quality members
IF_NO_SENTRIES If the concept of referring members didn't exist
NEXT_YN Feign the following Y[n] landing
QUALITY quality
PERCENT_REACHED % of referring members reached
NB_REACHED number of referring members reached
\ No newline at end of file
SUBMIT_BUTTON recharger
DISTRIBUTION_QUALITY distribution gaussienne de la qualité des membres
IF_NO_SENTRIES si le concept de membre référent n'existait pas
NEXT_YN Simuler le palier Y[n] suivant
QUALITY qualité
PERCENT_REACHED % de nombres référents atteints
NB_REACHED nombre de membres référents atteints
\ No newline at end of file
......@@ -17,4 +17,7 @@ Afficher l'évolution de la difficulté commune du réseau (preuve de travail)
MEMBERS_COUNT members
SENTRIES_COUNT referring* members
ISSUERS_COUNT Members co-writers blockchain
POW_MIN Common difficulty network (proof of work)
\ No newline at end of file
POW_MIN Common difficulty network (proof of work)
MAX max
POINTS points
REGULATE_BY_ADAPTING regulate by adapting
\ No newline at end of file
......@@ -16,4 +16,7 @@ SHOW_POW_MIN Afficher l'évolution de la difficulté commune du réseau (preuve
MEMBERS_COUNT Membres
SENTRIES_COUNT Membres référents*
ISSUERS_COUNT Membres co-écrivains de la blockchain Ğ1
POW_MIN Difficulté commune du réseau (preuve de travail)
\ No newline at end of file
POW_MIN Difficulté commune du réseau (preuve de travail)
MAX max
POINTS points
REGULATE_BY_ADAPTING réguler en adaptant
\ No newline at end of file
......@@ -30,7 +30,7 @@ PROPORTION_OF_EXIST_PATH Percent of pairs directed for which there is a path of
MEAN_LENGTH_PATH mean length shortest path
WOT_TENSION_FACTOR Wot tension factor*
DATA_AT Data at
meanMembersReachedByMembersInSingleExtCert Mean members/sentries reached in single member/sentry certification
meanMembersReachedByMembers Mean members/sentries reached in single member/sentry certification
SENTRIES_REACHED sentries reached
MEMBERS_REACHED members reached
SENTRY_CERT sentry certification
......@@ -40,6 +40,8 @@ PROPORTION_MEMBERS_WITH_QUALITY_UPPER_1 Proportion of members with an upper qual
CURRENT_BLOCKCHAIN_TIME Current blockchain time
TABLE_TITLE Members that will expire in less than
DAYS days
OF_WHICH of which
ARE_REFERRING_MEMBERS are referrings
COL_UID uid
COL_IDTY_WRITTEN_TIME identity written time
COL_LAST_RENEWAL last renewal
......@@ -60,5 +62,9 @@ EMITTED emitted
WRITTEN written
INVALID_BLOCKSTAMP invalid blockstamp
CERT_AVAILABLE available
OVERALL Overall
MEMBERS members
NEXT_YN Feign the following Y[n] landing
MEMBER_FILTER search a member
EXPIRE_TIME expiration datetime
RANDOM_LIST Draw lots
MEMBERS members
\ No newline at end of file
......@@ -30,7 +30,7 @@ PROPORTION_OF_EXIST_PATH Proportion de couples orientés pour lesquels il existe
MEAN_LENGTH_PATH Longueur moyenne d'un plus court chemin
WOT_TENSION_FACTOR Facteur de tension de la toile*
DATA_AT Données au
meanMembersReachedByMembersInSingleExtCert Taux moyen de membres joiniables via une seule certification
meanMembersReachedByMembers Taux moyen de membres joiniables via une seule certification
MEMBER_CERT certification d'un membre
MEMBERS_REACHED membres joiniables
SENTRY_CERT certification d'un membre référent
......@@ -40,6 +40,8 @@ PROPORTION_MEMBERS_WITH_QUALITY_UPPER_1 Proportion de membre avec une qualité >
CURRENT_BLOCKCHAIN_TIME Temps Blockchain actuel
TABLE_TITLE Membres dont le statut de membre va expirer dans moins de
DAYS jours
OF_WHICH dont
ARE_REFERRING_MEMBERS sont référents
COL_UID uid
COL_IDTY_WRITTEN_TIME obtention statut membre
COL_LAST_RENEWAL dernier renouvellement
......@@ -60,5 +62,9 @@ EMITTED émise
WRITTEN écrite
INVALID_BLOCKSTAMP blockstamp incorrect
CERT_AVAILABLE disponible
OVERALL Total
MEMBERS membres
NEXT_YN Simuler le palier Y[n] suivant
MEMBER_FILTER rechercher un membre
EXPIRE_TIME date et heure d'expiration
RANDOM_LIST Tirer au sort
MEMBERS membres
\ No newline at end of file
......@@ -2,7 +2,8 @@ LG en
WILL_MEMBERS willMembers
MEMBERS members
MEMBERS_COUNT membersCount
WOTEX wotex
GAUSSIAN_WOT_QUALITY gaussianWotQuality
BLOCK_COUNT blockCount
MONETARY_MASS monetaryMass
WOTEX wotex
ABOUT about
\ No newline at end of file
......@@ -2,6 +2,8 @@ LG fr
WILL_MEMBERS futurs membres
MEMBERS listes des membres
MEMBERS_COUNT nombre de membres
WOTEX wotex
GAUSSIAN_WOT_QUALITY qualité toile
BLOCK_COUNT nombre de blocs
MONETARY_MASS masse monétaire
WOTEX wotex
......
SUBMIT_BUTTON submit
\ No newline at end of file
SUBMIT_BUTTON submit
DESC1 The currency will be full when the money supply by member will be worth
UD UD
FULL_CURRENCY_FORMULA because 1/c * dtReeval/dt =
CURRENTLY Currently
AND_WE_HAVE and we have
DESC2 members. Thus in full currency we would have a total money supply of
MEMBER member
BEGIN Begin
END End
QUANTITATIVE quantitative
RELATIVE relative
PERCENT_OF_FULL_CURRENCY percent of full currency
MASS_BY_MEMBERS mass by members
TOTAL_MASS total mass
LOGARITHMIC logarithmic
LINEAR linear
MONETARY_MASS monetaryMass
IN_PERCENT_OF_FULL_CURRENCY in % of full currency
PERCENT_VARIATION_MONETARY_MASS % of variation of the monetary mass
BY_MEMBERS by members
IN_THE_RANGE in the range
\ No newline at end of file
SUBMIT_BUTTON recharger
\ No newline at end of file
SUBMIT_BUTTON recharger
DESC1 La monnaie sera pleine lorsque la masse monétaire par membre atteindra
The currency will be full when the money supply by member will be worth
UD DU
FULL_CURRENCY_FORMULA car 1/c * dtReeval/dt
CURRENTLY Actuellement
AND_WE_HAVE et nous sommes
DESC2 membres. Donc si la monnaie était pleine nous aurions une masse totale de
MEMBER membre
BEGIN Début
END Fin
QUANTITATIVE quantitatif
RELATIVE relatif
PERCENT_OF_FULL_CURRENCY pourcentage de monnaie pleine
MASS_BY_MEMBERS masse par membre
TOTAL_MASS masse totale
LOGARITHMIC logarithmique
LINEAR linéaire
MONETARY_MASS masse monetaire
IN_PERCENT_OF_FULL_CURRENCY en % de monnaie pleine
PERCENT_VARIATION_MONETARY_MASS % de variation de la masse monétaire
BY_MEMBER par membre
IN_THE_RANGE dans la période
\ No newline at end of file
......@@ -30,25 +30,28 @@ MEAN_SENTRIES_REACHED mean sentries reached
MEAN_QUALITY_CERTS Quality averages of the set of certifications
MEAN_MEMBERS_REACHED mean members reached
IDENTITY Identity
MEMBERSHIP_CASE membership case
MEMBERSHIP_CASE_FULL complete case ?
DISTANCE_RULE distance
COL_4 List of received certifications (recent -> old)
COL_4_WITH_AVAIlABILITY_SORT List of received certifications (by availability time)
PUBKEY_PART pubkey (first 16 characters)
EMITTE emitted
EMITTED_ON emitted on
AT_BLOCK at block
EXPIRE_ON expire on
EXPIRE_TIME expiration datetime
KO KO
OK OK
MEMBERSHIP_ASKED Membership asked
MEMBERSHIP_NOT_ASKED Membership not asked
YES yes
NO no
QUALITY_CERTIFIERS quality certifiers
QUALITY_CERTIFIERS package quality
DISTANCE Distance
CERTIFIERS_COUNT certifiers count
CERTS certifications
QUALITY quality
SIG_PERIOD_OK available
IDTY_REVOKED [identity revoked]
INVALID_BLOCKSTAMP invalid blockstamp
LAST_TR1 total
LAST_TR2 identities
LICENSE licence GPL-3.0
SRC source code
ON_WOTEX on wotex
IDTY_FILTER filter identities
MISS it's missing
......@@ -30,25 +30,28 @@ MEAN_SENTRIES_REACHED Taux moyen de membres référents joiniables
MEAN_QUALITY_CERTS Qualité moyenne par groupe de certifications reçues
MEAN_MEMBERS_REACHED Taux moyen de membres joiniables
IDENTITY Identité
MEMBERSHIP_CASE dossier d'adhésion
MEMBERSHIP_CASE_FULL dossier complet ?
DISTANCE_RULE distance
COL_4 liste des certifications reçues (récentes -> anciennes)
COL_4_WITH_AVAIlABILITY_SORT liste des certifications reçues (par date de disponibilité)
PUBKEY_PART clé publique (16 premiers caractères)
EMITTED émise
EMITTED_ON émise le
AT_BLOCK au bloc
EXPIRE_ON expire le
EXPIRE_TIME date et heure d'expiration
KO KO
OK OK
MEMBERSHIP_ASKED Adhésion demandée
MEMBERSHIP_NOT_ASKED Adhésion non demandée
YES oui
NO non
QUALITY_CERTIFIERS qualité certificateurs
QUALITY_CERTIFIERS qualité dossier
DISTANCE Distance
CERTIFIERS_COUNT Nombre de certificateurs
CERTS certifications
QUALITY qualité
SIG_PERIOD_OK disponible
IDTY_REVOKED [identité revoquée]
INVALID_BLOCKSTAMP blockstamp incorrect
LAST_TR1 total
LAST_TR2 identités
LICENSE licence GPL-3.0
SRC code source
ON_WOTEX sur wotex
IDTY_FILTER filtrer les identités
MISS il manque
......@@ -2,9 +2,18 @@
module.exports = {
USE_WOTB6: false,
DEFAULT_LANGUAGE: "fr",
MIN_WILLMEMBERS_UPDATE_FREQ: 180,
MIN_MEMBERS_UPDATE_FREQ: 180,
STEP_COUNT_MIN: 4,
STEP_COUNT_MAX: 150,
MIN_CACHE_UPDATE_FREQ: 150 // 2 min 30 (150 sec)
MIN_CACHE_UPDATE_FREQ: 150, // 2 min 30 (150 sec)
MIN_WOT_QUALITY_CACHE_UPDATE_FREQ: 300,
QUALITY_CACHE_ACTION : {
GET_QUALITY: 0,
GET_MEANS: 1,
INIT: 2,
GET_SENTRIES_COUNT: 3,
GET_D_SEN: 3
}
};
\ No newline at end of file
"use strict";
const co = require('co');
const os = require('os');
const fs = require('fs');
const webserver = require(__dirname + '/webserver.js');
//const duniter = require(__dirname + '/duniter.js');
const timestampToDatetime = require(__dirname + '/timestampToDatetime.js');
/****************************
* Main algorithm
*/
module.exports = (duniterServer, host, port, appParente, program) => co(function *() {
// Get local timezone offset
var x = new Date();
var offset = -x.getTimezoneOffset();
//timestampToDatetime(1000000, true, offset);
// Get monitDatasPath
const mdb = program.mdb || "duniter_default";
const monitDatasPath = os.homedir() + "/.config/duniter/" + mdb + "/currency-monit/";
// Create monitDatasPath
if (!fs.existsSync(monitDatasPath)) { fs.mkdirSync(monitDatasPath) }
// Define cache
var cache = {
......@@ -34,7 +48,7 @@ module.exports = (duniterServer, host, port, appParente, program) => co(function
console.log("module currency-monit started");
// Specialized node's UI
let httpServer = webserver(host, port, appParente, duniterServer, cache);
let httpServer = webserver(host, port, appParente, duniterServer, monitDatasPath, offset, cache);
yield httpServer.openConnection();
})
......
module.exports = function randomInt (low, high) {
return Math.floor(Math.random() * (high - low) + low);
}
module.exports = function timestampToDatetime(timestamp, onlyDate = false) {
// cache offset
var offset = 0;
module.exports = function timestampToDatetime(timestamp, onlyDate = false, offset_ = 0) {
if (offset_ != 0) {
offset = offset_;
}
// Apply offset
timestamp += offset*60; // offset is in minutes
// Convertir le timestamp en datetime
let tmptimestampExpireCertif = new Date(timestamp*1000);//tmpQueryGetTimeWrittenCert[0].medianTime)*1000);
let tmptimestampExpireCertifDay = tmptimestampExpireCertif.getDate();
......
This diff is collapsed.
......@@ -13,7 +13,7 @@ const bodyParser = require('body-parser');
const routes = require(__dirname + '/../routes');
const tpl = require(__dirname + '/tplit.js');
module.exports = (host, port, appParente, duniterServer, cache) => {
module.exports = (host, port, appParente, duniterServer, monitDatasPath, offset, cache) => {
var app = express();
......@@ -31,13 +31,31 @@ module.exports = (host, port, appParente, duniterServer, cache) => {
app.set('view engine', 'html') // register the template engine
app.locals.duniterServer = duniterServer
app.locals.monitDatasPath = monitDatasPath
app.locals.currencyName = duniterServer.conf.currency
app.locals.offset = offset
app.locals.cache = cache
app.locals.HTML_HEAD = fs.readFileSync(__dirname + '/../views/HEAD.html', 'utf-8')
app.locals.HTML_TOR_HEAD = fs.readFileSync(__dirname + '/../views/TOR_HEAD.html', 'utf-8')
app.use( routes )
/***************************************
* CSV des membres calculants
***************************************/
app.get('/csvCalculatorsRank', function(req, res) {
let files = fs.readdirSync(monitDatasPath + '/calculators_rank/')
let maxTimestamp = 0
for (let file of files) {
let fileTimestamp = parseInt(file.split('_')[2])
if (fileTimestamp > maxTimestamp) {
maxTimestamp = fileTimestamp
}
}
var file = monitDatasPath + '/calculators_rank/calculators_rank_' + maxTimestamp + '.csv';
res.download(file); // Set disposition and send it.
});
// Si l'on ne dispose pas d'un serveur web parent, lancer notre propre serveur web
if ( appParente == null )
......
{
"name": "duniter-currency-monit",
"version": "0.3.7",
"version": "0.4.11",
"main": "index.js",
"license": "AGPLv3",
"dependencies": {
"body-parser": "1.15.1",
"co": "^4.6.0",
"express": "4.13.4",
"body-parser": "1.17.1",
"co": "4.6.0",
"express": "4.15.2",
"fs-extra": "^3.0.1",
"http": "0.0.0",
"morgan": "1.7.0",
"node-pre-gyp": "^0.6.34",
"morgan": "1.8.1",
"node-pre-gyp": "0.6.34",
"q": "1.5.0",
"request": "^2.81.0",
"request-promise": "4.2.0"
},
"devDependencies": {
"duniter": "1.3.14",
"duniter-bma": "1.3.x",
"duniter-crawler": "1.3.x",
"duniter-keypair": "1.3.x",
"duniter-prover": "1.3.x"
"duniter": "1.6.x"
},
"peerDependencies": {
"duniter": "1.3.14"
"duniter": "1.6.x"
}
}
# Currency-Monit Module
Requires Duniter 1.3.9 or higher
Requires Duniter 1.6.22 or higher
## Installation
......@@ -11,7 +11,11 @@ Requires Duniter 1.3.9 or higher
1. go to localhost:9220/#/main/settings/modules
and at the foot of page enter:
```bash
<<<<<<< HEAD
https://github.com/duniter/duniter-currency-monit/archive/0.3.7.tar.gz
=======
duniter-currency-monit@0.4.5
>>>>>>> dev2
```
then clik to button INSTALL THIS MODULE
......@@ -24,7 +28,11 @@ then clik to button INSTALL THIS MODULE
2. plug the plugin to your duniter node:
```bash
<<<<<<< HEAD
duniter plug https://github.com/duniter/duniter-currency-monit/archive/0.3.7.tar.gz
=======
duniter plug duniter-currency-monit@0.4.5
>>>>>>> dev2
```
3. Stop your duniter node and restart it in the following method:
......
#!/bin/bash
current=`grep -P "version\": \"\d+.\d+.\d+(\w*)" package.json | grep -oP "\d+.\d+.\d+(\w*)"`
echo "Current version: $current"
if [[ $1 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ ]]; then
# Change the version in package.json and test file
sed -i "s/version\": \"$current/version\": \"$1/g" package.json
sed -i "s/$current/$1/g" views/about.html
# Commit
git reset HEAD
git add package.json views/about.html
git commit -m "v$1"
git tag "v$1"
else
echo "Wrong version format"
fi
This diff is collapsed.
"use strict";
const co = require('co')
const constants = require(__dirname + '/../lib/constants')
const membersQuality = require(__dirname + '/tools/membersQuality')
const getLang = require(__dirname + '/../lib/getLang')
// gaussianWotQuality cache
var previousNextYn = "no";
module.exports = (req, res, next) => co(function *() {
var { duniterServer } = req.app.locals
try {
// get GET parameters
const format = req.query.format || 'HTML';
const sentries = req.query.sentries || 'yes';
const unit = req.query.unit || 'quality';
const nextYn = (req.query.nextYn=="yes") ? "yes":"no";
// get lg file
const LANG = getLang(`${__dirname}/../lg/gaussianWotQuality_${req.query.lg||constants.DEFAULT_LANGUAGE}.txt`);
// Définition des contantes
const conf = duniterServer.conf;
const qualityMax = (1/conf.xpercent);
// Définition des variables
let lastUpgradeTimeDatas = membersQuality(constants.QUALITY_CACHE_ACTION.INIT);
let tabUidIndex = [];
let tabMembersQuality= [];
let tabMembersQualitySorted = [];
let tabLabels = [];
let tabColors = [];
let tabLimit1 = [];
// Récupérer la liste des identités ayant actuellement le statut de membre
let membersList = yield duniterServer.dal.peerDAL.query('SELECT `uid`,`wotb_id` FROM i_index WHERE `member`=1');
// Si les données de qualité n'ont jamais été calculés, le faire
if (lastUpgradeTimeDatas == 0 || (lastUpgradeTimeDatas+constants.MIN_WOT_QUALITY_CACHE_UPDATE_FREQ) < (Math.floor(Date.now() / 1000)) || (previousNextYn != nextYn))
{
// Calculer dSen
var dSen = Math.ceil(Math.pow(membersList.length, 1 / conf.stepMax));
if (nextYn == "yes") { dSen++; }
// récupérer la wot
const wot = duniterServer.dal.wotb;
// Initialiser le cache des données de qualité
membersQuality(constants.QUALITY_CACHE_ACTION.INIT, 0, dSen, conf.stepMax, conf.xpercent, wot.memCopy());
}
// Mettre a jour previousNextYn
previousNextYn = (nextYn=="yes") ? "yes":"no";
// Calculer nbSentries, limit1 and label
const nbSentries = (sentries=="no") ? membersList.length:membersQuality(constants.QUALITY_CACHE_ACTION.GET_SENTRIES_COUNT);
let limit1 = 1;
let label = LANG['QUALITY'];
switch (unit)
{
case 'percentReached': limit1 = conf.xpercent*100; label = LANG['PERCENT_REACHED']; break;
case 'nbReached': limit1 = parseInt(conf.xpercent*nbSentries); label = LANG['NB_REACHED']; break;
default: break;
}
// Remplir les tableaux tabUidIndex et tabLimit1
for(const member of membersList)
{
tabUidIndex[member.wotb_id] = member.uid;
tabLimit1.push(limit1);
}
// Récupérer le tableau de qualité des membres
tabMembersQuality= [];
for (let i=0;membersQuality(constants.QUALITY_CACHE_ACTION.GET_QUALITY, i) >= 0;i++)
{
if (sentries == "no")
{
tabMembersQuality[i] = membersQuality(constants.QUALITY_CACHE_ACTION.GET_QUALITY, i, -1);
}
else
{
tabMembersQuality[i] = membersQuality(constants.QUALITY_CACHE_ACTION.GET_QUALITY, i);
}
}
// Initialisation du tableau tabMembersQualitySorted
for (let i=0;i<tabMembersQuality.length;i++)
{
tabMembersQualitySorted.push(0);
}
// Trier le tableau de façon gaussienne
let debut = true;
let membersQualityAlreadyCounted = [];
for (let i=0;i<tabMembersQuality.length;i++)
{
let min = qualityMax;
let idMin = 0;
for (let j=0;j<tabMembersQuality.length;j++)
{
if (tabMembersQuality[j] < min && typeof(membersQualityAlreadyCounted[j])=='undefined')
{
min = tabMembersQuality[j];
idMin = j;
}
}
// Remplir les tableaux triée de façon gaussienne
let idGaussian = parseInt(i/2);
if(!debut)
{
idGaussian = parseInt(tabMembersQuality.length-(i/2));
}
debut = !debut;
tabMembersQualitySorted[idGaussian] = tabMembersQuality[idMin];
// Exclure les membres déjà traités
membersQualityAlreadyCounted[idMin] = true;
// Définir le label pour cet abscisse
tabLabels[idGaussian] = tabUidIndex[idMin];
// Définir la couleur
if (tabMembersQuality[idMin] >= 1.10)
{
tabColors[idGaussian] = 'rgba(128, 0, 128, 0.5)';
}
else if (tabMembersQuality[idMin] >= 1.05)
{
tabColors[idGaussian] = 'rgba(0, 0, 255, 0.5)';
}
else if (tabMembersQuality[idMin] >= 1.00)
{
tabColors[idGaussian] = 'rgba(0, 255, 0, 0.5)';
}
else if (tabMembersQuality[idMin] >= 0.95)
{
tabColors[idGaussian] = 'rgba(255, 128, 0, 0.5)';
}
else if (tabMembersQuality[idMin] >= 0.90)
{
tabColors[idGaussian] = 'rgba(255, 0, 0, 0.5)';
}
else
{
tabColors[idGaussian] = 'rgba(0, 0, 0, 0.5)';
}
}
// Si le client demande les données dans une autre unité, faire la transformation
let unitCoeff = 1.0;
if (unit=='percentReached' || unit=='nbReached')
{
unitCoeff = parseFloat(conf.xpercent);
if (unit=='nbReached') { unitCoeff *= parseFloat(nbSentries); }
else { unitCoeff *= 100.0; }
for (let i=0;i<tabMembersQualitySorted.length;i++)
{
tabMembersQualitySorted[i] = parseInt(tabMembersQualitySorted[i]*unitCoeff);
}
}
// Si le client demande la réponse au format JSON, le faire
if (format == 'JSON')
{
let tabJson = [];
for (let i=0;i<tabMembersQualitySorted.length;i++)
{
tabJson.push({