portfolio: Fix cost/pnl hidden value if empty text. #243

pull/250/head
Miguel Mota 3 years ago committed by Simon Roberts
parent 0e956d6358
commit e99d46b424
No known key found for this signature in database
GPG Key ID: 0F30F99E6B771FD4

@ -337,12 +337,12 @@ func (ct *Cointop) GetPortfolioTable() *table.Table {
})
case "cost_price":
text := fmt.Sprintf("%s %s", coin.BuyCurrency, ct.FormatPrice(coin.BuyPrice))
if ct.State.hidePortfolioBalances {
text = HiddenBalanceChars
}
if coin.BuyPrice == 0.0 || coin.BuyCurrency == "" {
text = ""
}
if ct.State.hidePortfolioBalances {
text = HiddenBalanceChars
}
symbolPadding := 1
ct.SetTableColumnWidth(header, utf8.RuneCountInString(text)+symbolPadding)
ct.SetTableColumnAlignLeft(header, false)
@ -363,12 +363,12 @@ func (ct *Cointop) GetPortfolioTable() *table.Table {
}
}
text := humanize.FixedMonetaryf(cost, 2)
if ct.State.hidePortfolioBalances {
text = HiddenBalanceChars
}
if coin.BuyPrice == 0.0 {
text = ""
}
if ct.State.hidePortfolioBalances {
text = HiddenBalanceChars
}
symbolPadding := 1
ct.SetTableColumnWidth(header, utf8.RuneCountInString(text)+symbolPadding)
@ -429,13 +429,13 @@ func (ct *Cointop) GetPortfolioTable() *table.Table {
colorProfit = ct.colorscheme.TableColumnChangeDown
}
text := fmt.Sprintf("%.2f%%", profitPercent)
if coin.BuyPrice == 0.0 {
text = ""
}
if ct.State.hidePortfolioBalances {
text = HiddenBalanceChars
colorProfit = ct.colorscheme.TableColumnChange
}
if coin.BuyPrice == 0.0 {
text = ""
}
ct.SetTableColumnWidthFromString(header, text)
ct.SetTableColumnAlignLeft(header, false)
rowCells = append(rowCells,

Loading…
Cancel
Save