Fix formatting of amounts in explorer

This commit is contained in:
Martin Boehm 2018-06-28 22:41:46 +02:00
parent ce5462118c
commit 20643756e5
3 changed files with 4 additions and 4 deletions

View File

@ -97,7 +97,7 @@ func (w *Worker) GetTransaction(txid string, bestheight uint32, spendingTx bool)
Locktime: bchainTx.LockTime,
WithSpends: spendingTx,
Time: bchainTx.Time,
Txid: txid,
Txid: bchainTx.Txid,
ValueIn: valIn,
ValueOut: valOut,
Version: bchainTx.Version,

View File

@ -108,7 +108,7 @@ func formatUnixTime(ut int64) string {
}
func formatAmount(a float64) string {
return fmt.Sprintf("%0.8f", a)
return strings.TrimRight(strings.TrimRight(fmt.Sprintf("%0.8f", a), "0"), ".")
}
// Run starts the server

View File

@ -22,7 +22,7 @@
<a href="/explorer/address/{{$vin.Addr}}">{{$vin.Addr}}</a>
{{else}}Unparsed address{{end}}
</span>
<span class="float-right"> {{$vin.Value}} {{$cs}} </span>
<span class="float-right"> {{formatAmount $vin.Value}} {{$cs}} </span>
{{else}}No Inputs (Newly Generated Coins){{end}}
</td>
</tr>
@ -50,7 +50,7 @@
{{else}}
<span class="float-left">Unparsed address</span>
{{end}}
<span class="float-right">{{$vout.Value}} {{$cs}}</span>
<span class="float-right">{{formatAmount $vout.Value}} {{$cs}}</span>
</td>
</tr>
{{end}}