From 27abf57a440fdf8adf21f52093ca847d7b220c89 Mon Sep 17 00:00:00 2001 From: poka Date: Mon, 5 Oct 2020 09:39:48 +0200 Subject: [PATCH] Explorer: Add print command; G1Stats: Use explorer print to export cumulate json --- explorer.sh | 12 ++++++++---- lib/functions.sh | 3 ++- lib/scanTxWallets.sh | 2 -- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/explorer.sh b/explorer.sh index 5d19069..a38c163 100755 --- a/explorer.sh +++ b/explorer.sh @@ -75,14 +75,14 @@ for i in $@; do case "$i" in -c|--cumulate) jsonData="$(jq "$jqCumulate" <<<$jsonData)";; -h|--help) helpOpt && exit 0;; - *) isOptions+="$i|";; + *) isArg+="$i|";; esac done # Load arguments in respective variables -cmd=$(cut -d'|' -f1 <<<"$isOptions") -dateRange=$(cut -d'|' -f2 <<<"$isOptions") -args="$(cut -d'|' -f2- <<<"$isOptions" | sed 's/.$//' | tr '|' ' ')" +cmd=$(cut -d'|' -f1 <<<"$isArg") +dateRange=$(cut -d'|' -f2 <<<"$isArg") +args="$(cut -d'|' -f2- <<<"$isArg" | sed 's/.$//' | tr '|' ' ')" # If no date, set last available [[ -z "$dateRange" ]] && dateRange=$(jq -r '.[].date' <<<$jsonData | tail -n1) @@ -134,6 +134,10 @@ anniversary() { jq "$jqNewUD" <<<$jsonData } +print() { + jq . <<<"$jsonData" +} + # Load functions case $cmd in '') day;; diff --git a/lib/functions.sh b/lib/functions.sh index 8c10f2f..fc4bbd2 100755 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -61,7 +61,8 @@ 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,cum-daily.json} $WEBPATH/data/ + cp $GPATH/db/daily.json $WEBPATH/data/ + $GPATH/explorer.sh print -c > $WEBPATH/data/cum-daily.json if [[ "$startTime" == "00:00" ]]; then cp $indexhtml $WEBPATH/history/index_$day.html diff --git a/lib/scanTxWallets.sh b/lib/scanTxWallets.sh index c4df684..a016d8c 100755 --- a/lib/scanTxWallets.sh +++ b/lib/scanTxWallets.sh @@ -251,8 +251,6 @@ scanTxWallets() { .rWallets = (\$row.rWallets + .rWallets|roundit); \$row + . )]" - jq "$jqCumulate" $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