From 678653ac30d592ab4381e3514a9936af292fccd3 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Fri, 25 Sep 2020 16:47:31 +0200 Subject: [PATCH] update getCollectionPage Update getCollectionPage godoc and reduce logic and variable assignments --- collections.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/collections.go b/collections.go index edde677..2295837 100644 --- a/collections.go +++ b/collections.go @@ -723,14 +723,14 @@ func newDisplayCollection(c *Collection, cr *collectionReq, page int) *DisplayCo return coll } +// getCollectionPage returns the collection page as an int. If the parsed page value is not +// greater than 0 then the default value of 1 is returned. func getCollectionPage(vars map[string]string) int { - page := 1 - var p int - p, _ = strconv.Atoi(vars["page"]) - if p > 0 { - page = p + if p, _ := strconv.Atoi(vars["page"]); p > 0 { + return p } - return page + + return 1 } // handleViewCollection displays the requested Collection