From 8f645d7ccb01c15650958f2f9dd14f15f9afd72b Mon Sep 17 00:00:00 2001 From: lost+skunk Date: Fri, 14 Jun 2024 00:05:21 +0300 Subject: небольшие улучшения MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- misc.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'misc.go') diff --git a/misc.go b/misc.go index d5f6793..5976e80 100644 --- a/misc.go +++ b/misc.go @@ -116,13 +116,13 @@ func AEmedia(name string, t rune) (string, error) { } /* SEARCH */ -type search struct { - Total int `json:"estTotal"` - Pages int // only for 'a' and 'g' scope. - Results []deviantion `json:"deviations,results"` +type Search struct { + Total int `json:"estTotal"` + Pages int // only for 'a' and 'g' scope. + Results []Deviation `json:"deviations,results"` } -func Search(query string, page int, scope rune, user ...string) (ss search, e error) { +func SearchFunc(query string, page int, scope rune, user ...string) (ss Search, e error) { var url strings.Builder e = nil @@ -159,7 +159,8 @@ func Search(query string, page int, scope rune, user ...string) (ss search, e er ujson(url.String(), &ss) // расчёт, сколько всего страниц по запросу. без токена 417 страниц - максимум - for x := 0; x < int(math.Round(float64(ss.Total/25))); x++ { + totalfloat := int(math.Round(float64(ss.Total / 25))) + for x := 0; x < totalfloat; x++ { if x <= 417 { ss.Pages = x } -- cgit v1.2.3