From d61d083ed6dd7795fcf702be864fb2067e1b5845 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Sun, 24 Nov 2024 11:33:42 +0200 Subject: [PATCH] Add showing currency symbol for card name if it is possible --- handlers/card.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/handlers/card.go b/handlers/card.go index a626448..932c38b 100644 --- a/handlers/card.go +++ b/handlers/card.go @@ -12,8 +12,10 @@ import ( var cardTransform func(inp *db.Card) types.DbCard = func(inp *db.Card) types.DbCard { var curr types.DbCurrency + symbolPostfixForCard := "" if inp.Currency != nil { curr = currencyTransform(inp.Currency) + symbolPostfixForCard = fmt.Sprintf(" (%s)", inp.Currency.Symbol) } else { curr = types.DbCurrency{} } @@ -26,7 +28,7 @@ var cardTransform func(inp *db.Card) types.DbCard = func(inp *db.Card) types.DbC LastDigits: inp.LastDigits, CurrencyID: inp.CurrencyID, Currency: curr, - DisplayName: fmt.Sprintf("%s •%s", inp.Name, inp.LastDigits), + DisplayName: fmt.Sprintf("%s •%s%s", inp.Name, inp.LastDigits, symbolPostfixForCard), } }