Retain stocks order by default

This commit is contained in:
Svilen Markov
2024-05-01 22:28:59 +01:00
parent 58967ab758
commit 948c117f5b
2 changed files with 9 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import (
type Stocks struct {
widgetBase `yaml:",inline"`
Stocks feed.Stocks `yaml:"-"`
Sort string `yaml:"sort-by"`
Tickers []feed.StockRequest `yaml:"stocks"`
}
@@ -28,7 +29,10 @@ func (widget *Stocks) Update(ctx context.Context) {
return
}
stocks.SortByAbsChange()
if widget.Sort == "absolute-change" {
stocks.SortByAbsChange()
}
widget.Stocks = stocks
}