forked from axiom-team/g1-stats
Improve explorer; Add jq file for cumulate nbrMembres
This commit is contained in:
parent
62a30b0260
commit
b74036c39d
11
explorer.sh
11
explorer.sh
|
@ -1,9 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
dateRange=$2
|
|
||||||
jsonFile="db/daily.json"
|
jsonFile="db/daily.json"
|
||||||
|
dateRange=$2
|
||||||
|
[[ -z $dateRange ]] && dateRange=$(jq -r '.[].date' $jsonFile | tail -n1)
|
||||||
lineNbr=$(grep -n "$dateRange" $jsonFile | cut -d : -f 1)
|
lineNbr=$(grep -n "$dateRange" $jsonFile | cut -d : -f 1)
|
||||||
[[ -z $lineNbr ]] && echo "La date $dateRange n'existe pas en blockchain" && exit 1
|
[[ -z $lineNbr ]] && echo "La date $dateRange n'existe pas en cache G1Stats" && exit 1
|
||||||
|
|
||||||
cumulate() {
|
cumulate() {
|
||||||
lineNbr=$(($lineNbr+7))
|
lineNbr=$(($lineNbr+7))
|
||||||
|
@ -42,4 +43,8 @@ day() {
|
||||||
jq . <<<"$jsonDated"
|
jq . <<<"$jsonDated"
|
||||||
}
|
}
|
||||||
|
|
||||||
$1
|
mass() {
|
||||||
|
jq -f lib/sumNbrMembers.jq $jsonFile | jq '.UD*.nbrMembers' | awk '{ SUM += $1} END { printf "%.2f", SUM }'; echo
|
||||||
|
}
|
||||||
|
|
||||||
|
$1
|
||||||
|
|
|
@ -21,6 +21,8 @@ addMembers() {
|
||||||
done
|
done
|
||||||
[[ -d $tmpSplit ]] && rm -r $tmpSplit || exit 1
|
[[ -d $tmpSplit ]] && rm -r $tmpSplit || exit 1
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
|
echo "$wallets" > tata
|
||||||
}
|
}
|
||||||
|
|
||||||
web() {
|
web() {
|
||||||
|
@ -99,8 +101,7 @@ sumSoldes() {
|
||||||
soldeM=$(echo $soldeMBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
|
soldeM=$(echo $soldeMBrut | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
|
||||||
|
|
||||||
### Calcul de la masse monétaire et du pourcentage de Ḡ1 sur les simples portefeuilles ###
|
### Calcul de la masse monétaire et du pourcentage de Ḡ1 sur les simples portefeuilles ###
|
||||||
monetaryMass=$(curl -s ${DUNITER}/blockchain/current | jq .monetaryMass)
|
monetaryMassBrut=$(curl -s ${DUNITER}/blockchain/current | jq .monetaryMass | xargs -i echo "scale=2; ({}/100)/1" | bc)
|
||||||
monetaryMassBrut=$(echo "scale=2; ($monetaryMass/100)/1" | bc)
|
|
||||||
monetaryMass=$(echo "$monetaryMassBrut" | tr . , | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
|
monetaryMass=$(echo "$monetaryMassBrut" | tr . , | sed ':a;s/\B[0-9]\{3\}\>/ &/;ta')
|
||||||
|
|
||||||
pourcentSimpleWallet=$(echo "$soldeWBrut*100/$monetaryMassBrut/1" | bc -l | xargs printf %.1f)
|
pourcentSimpleWallet=$(echo "$soldeWBrut*100/$monetaryMassBrut/1" | bc -l | xargs printf %.1f)
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
def accumulates(f):
|
||||||
|
foreach .[] as $row
|
||||||
|
(0;
|
||||||
|
. + ($row | f) ;
|
||||||
|
. as $x | $row | (f = $x));
|
||||||
|
accumulates(.nbrMembers)
|
Loading…
Reference in New Issue