Skip to content

Commit c494add

Browse files
committed
Fix goconst lint issue (handler.go + templates.templ)
1 parent 4ba3dd5 commit c494add

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

internal/ui/fundetail/handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
const (
1515
top5Limit = 5
16+
top5Filter = "top5"
1617
presetCurrent = "current"
1718
presetHistory = "history"
1819
)
@@ -90,7 +91,7 @@ func (h *Handler) handleHistory(w http.ResponseWriter, r *http.Request, category
9091

9192
data := chartdata.Build(allSeries)
9293

93-
if filter == "top5" && len(data.Datasets) > top5Limit {
94+
if filter == top5Filter && len(data.Datasets) > top5Limit {
9495
data.Datasets = data.Datasets[:top5Limit]
9596
}
9697

internal/ui/fundetail/templates.templ

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ templ FunDetailHistoryContent(category string, data chartdata.Data, filter strin
2222
</popularity-chart>
2323
<h2 class="mt-4">Filters</h2>
2424
<div class="btn-group" role="group" aria-label="Filter chart data">
25-
if filter != "top5" {
25+
if filter != top5Filter {
2626
<a class="btn btn-primary" href={ templ.SafeURL("/fun/" + category + "/history") }>All</a>
2727
} else {
2828
<a class="btn btn-outline-primary" href={ templ.SafeURL("/fun/" + category + "/history") }>All</a>
2929
}
30-
if filter == "top5" {
30+
if filter == top5Filter {
3131
<a class="btn btn-primary" href={ templ.SafeURL("/fun/" + category + "/history?filter=top5") }>Top 5</a>
3232
} else {
3333
<a class="btn btn-outline-primary" href={ templ.SafeURL("/fun/" + category + "/history?filter=top5") }>Top 5</a>

0 commit comments

Comments
 (0)