1
0
mirror of https://github.com/taigrr/wtf synced 2026-03-21 17:42:18 -07:00

Keep an initial order of the currencies so they won't be in a different order after refreshing (#752)

This purely happend due to maps not keeping the order items are in. This way
it at least won't change throughout the runtime of wtfutil. Ideally it would
use and keep the order as specified by the user in the configuration but
right now there is no way to enforce this.
This commit is contained in:
Toon Schoenmakers
2019-11-17 03:47:52 +00:00
committed by Chris Cummer
parent f81c0adb0f
commit c8a14e7685
2 changed files with 6 additions and 2 deletions

View File

@@ -55,10 +55,11 @@ func (widget *Widget) content() (string, string, bool) {
if widget.err != nil {
out = widget.err.Error()
} else {
for base, rates := range widget.rates {
for base, rates := range widget.settings.rates {
out += fmt.Sprintf("[%s]Rates from %s[white]\n", widget.settings.common.Colors.Subheading, base)
idx := 0
for cur, rate := range rates {
for _, cur := range rates {
rate := widget.rates[base][cur]
out += fmt.Sprintf("[%s]%s - %f[white]\n", widget.CommonSettings().RowColor(idx), cur, rate)
idx++
}