diff --git a/g1-stats.sh b/g1-stats.sh index fccd775..74883a9 100755 --- a/g1-stats.sh +++ b/g1-stats.sh @@ -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 ---" diff --git a/tpl/index.html b/tpl/index.html index 51f0467..3d41531 100644 --- a/tpl/index.html +++ b/tpl/index.html @@ -19,7 +19,7 @@ Nombre total de wallet: _nbrTotalWallets Nombre de membres: _nbrMembers (_pourcentMbrs%) Nombre de simple portefeuille: _nbrSimpleWallets (_pourcentWallets%) --- -Reçus simples portefeuille: _txInSimple Ḡ1 +Reçus simples portefeuille: _txInSimple Ḡ1 Voir le graphique Envoyé simples portefeuille: _txOutSimple Ḡ1 Soldes simples portefeuille: _soldeSimple Ḡ1 (_pourcentSimpleWallet% de la masse monétaire totale) --- diff --git a/transform_json.sh b/transform_json.sh index f0005c3..092cd24 100755 --- a/transform_json.sh +++ b/transform_json.sh @@ -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 '' '{ 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 '' '{ 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