Integrate transform json to g1-stats mechanic

This commit is contained in:
poka 2020-06-18 03:49:13 +02:00
parent f159857e13
commit 804b5fe779
3 changed files with 12 additions and 4 deletions

View File

@ -143,6 +143,11 @@ web() {
sed -i "s/_dateNext/$day/g" $WEBPATH/history/index_$datePrevious.html
sed -i "s/style=\"display:none;\" class=\"next\"/class=\"next\"/g" $WEBPATH/history/index_$datePrevious.html
fi
# Export JSON for graph
$SCRIPTPATH/transform_json.sh
# chown www-data for nginx needs
chown -R www-data:www-data $WEBPATH
echo "--- DEBUG WEB DATE ---"

View File

@ -19,7 +19,7 @@ Nombre total de wallet: <b>_nbrTotalWallets</b>
Nombre de membres: <b>_nbrMembers</b> (_pourcentMbrs%)
Nombre de simple portefeuille: <b>_nbrSimpleWallets</b> (_pourcentWallets%)
---
Reçus simples portefeuille: <b>_txInSimple Ḡ1</b>
Reçus simples portefeuille: <b>_txInSimple Ḡ1</b> <a href="/graph.html">Voir le graphique</a>
Envoyé simples portefeuille: <b>_txOutSimple Ḡ1</b>
Soldes simples portefeuille: <b>_soldeSimple Ḡ1</b> (_pourcentSimpleWallet% de la masse monétaire totale)
---

View File

@ -1,6 +1,9 @@
#!/bin/bash
rWallets=$(cat /home/axiom/apps/g1-stats/history/index_*.html | grep -E "Date:|Reçus simples wallets|Reçus simples portefeuille" | awk -F '<b>' '{ print $2 }' | awk '{ print $1 }' | tr -d '.' | tr ',' '.')
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
if [[ -e $SCRIPTPATH/.env ]]; then source $SCRIPTPATH/.env; else echo "Veuillez créer votre fichier .env inspiré de .env.example" && exit 1; fi
rWallets=$(cat $WEBPATH/history/index_*.html | grep -E "Date:|Reçus simples wallets|Reçus simples portefeuille" | awk -F '<b>' '{ print $2 }' | awk '{ print $1 }' | tr -d '.' | tr ',' '.')
j=0
for i in $rWallets; do
@ -11,9 +14,9 @@ for i in $rWallets; do
j=1
else
result+=$(sed s/_RWALLET/$i/g rWallets-$dateN.json)
j=0
rm rWallets-$dateN.json
j=0
fi
done
sed "s/_JSONDATA/$result/g" tpl/graph.html > graph.html
sed "s/_JSONDATA/$result/g" tpl/graph.html > $WEBPATH/graph.html