Add cumulate.jq to generate JSON with cumulate values; Display graph on home page
This commit is contained in:
parent
faa525b743
commit
ca5dafb15d
|
@ -57,7 +57,7 @@ day() {
|
|||
mass() {
|
||||
lineNbr=$(($lineNbr+7))
|
||||
jsonDated="$(head -n$lineNbr $jsonFile)}]"
|
||||
jq -f $GPATH/lib/sumNbrMembers.jq <<<"$jsonDated" | jq '.UD*.nbrMembers' | awk '{ SUM += $1} END { printf "%.2f", SUM }'; echo
|
||||
jq -f $GPATH/lib/cumulate.jq <<<"$jsonDated" | jq '.[] | .UD*.nbrMembers' | awk '{ SUM += $1} END { printf "%.2f", SUM }'; echo
|
||||
}
|
||||
|
||||
[[ -z $cmd ]] && cmd=cumulate
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
def roundit: .*100.0|round/100.0;
|
||||
[foreach .[] as $row ({nbrMembers: 0, nbrWallets: 0, sMembers: 0, rMembers: 0, sWallets: 0, rWallets: 0};
|
||||
{
|
||||
nbrMembers: ($row.nbrMembers + .nbrMembers),
|
||||
nbrWallets: ($row.nbrWallets + .nbrWallets),
|
||||
sMembers: ($row.sMembers + .sMembers|roundit),
|
||||
rMembers: ($row.rMembers + .rMembers|roundit),
|
||||
sWallets: ($row.sWallets + .sWallets|roundit),
|
||||
rWallets: ($row.rWallets + .rWallets|roundit)
|
||||
};
|
||||
$row * .
|
||||
)]
|
|
@ -61,7 +61,7 @@ web() {
|
|||
echo "$wallets" | grep . > $WEBPATH/data/wallets-g1.txt
|
||||
echo -e "$membresPubkeys" | sed 's/ /\n/g' > $WEBPATH/data/wallets-g1-membres.txt
|
||||
echo -e "$simpleWallets" > $WEBPATH/data/wallets-g1-simple.txt
|
||||
cp $GPATH/db/daily.json $WEBPATH/data/
|
||||
cp $GPATH/db/{daily.json,cum-daily.json} $WEBPATH/data/
|
||||
|
||||
if [[ "$startTime" == "00:00" ]]; then
|
||||
cp $indexhtml $WEBPATH/history/index_$day.html
|
||||
|
|
|
@ -240,6 +240,9 @@ scanTxWallets() {
|
|||
sed -i '$ s/,//g' $jsonFile
|
||||
echo "]" >> $jsonFile
|
||||
|
||||
# On génère le JSON équivalent avec données cumulatives
|
||||
jq -f $GPATH/lib/cumulate.jq $jsonFile > $GPATH/db/cum-daily.json
|
||||
|
||||
# On supprime les doublons et les lignes vides
|
||||
wallets=$(echo -e "$wallets" | sort -u | awk 'NF')
|
||||
# On écrit les pubkeys avec transaction dans un fichier de cache pour la prochaine itération
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
def accumulates(f):
|
||||
foreach .[] as $row
|
||||
(0;
|
||||
. + ($row | f) ;
|
||||
. as $x | $row | (f = $x));
|
||||
accumulates(.nbrMembers)
|
|
@ -1,16 +1,23 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
||||
<title>Ḡ1 Stats</title>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/charts.css">
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/Chart.js"></script>
|
||||
<script type="text/javascript" src="js/graph.js"></script>
|
||||
<title>Ḡ1 Stats</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<center><h1>La Ḡ1 en quelques chiffres</h1>
|
||||
<h3>Beta</h3>
|
||||
<a href="/data/daily.json">Voir le fichier JSON</a></center>
|
||||
<center><h1>Ḡ1 Stats</h1>
|
||||
| <a href="/data/daily.json">Voir le fichier JSON</a>
|
||||
| <a href="/data/wallets-g1.txt">Liste de tous les wallets</a>
|
||||
| <a href="/data/wallets-g1-membres.txt">Liste des wallets membres</a>
|
||||
| <a href="/data/wallets-g1-simple.txt">Liste des simples portefeuilles</a> |
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<div id="mainbloc">
|
||||
|
@ -38,10 +45,20 @@ Masse monétaire: <b>_monetaryMass Ḡ1</b>
|
|||
</pre>
|
||||
</div>
|
||||
|
||||
<div id="charts">
|
||||
<center><h2 id="titleRW">Ḡ1 reçus sur les wallets</h2></center>
|
||||
<canvas id="chartRW" width="1600" height="500"></canvas>
|
||||
</div>
|
||||
</center>
|
||||
|
||||
<div id="charts">
|
||||
<center><h2 id="titleNBRW">Nombre de wallets</h2></center>
|
||||
<canvas id="chartNBRW" width="1600" height="500"></canvas>
|
||||
</div>
|
||||
</center>
|
||||
|
||||
|
||||
<center>
|
||||
| <a href="/data/wallets-g1.txt">Liste de tous les wallets</a>
|
||||
| <a href="/data/wallets-g1-membres.txt">Liste des wallets membres</a>
|
||||
| <a href="/data/wallets-g1-simple.txt">Liste des simples portefeuilles</a> |
|
||||
|
||||
<br><br>
|
||||
Ces données sont mises à jours toutes les 3 heures.<br>
|
||||
|
|
Loading…
Reference in New Issue