From fc8b4d6517213a371e26938ff2c0319d5e5f459a Mon Sep 17 00:00:00 2001 From: knotteye Date: Fri, 2 Jul 2021 15:22:00 -0500 Subject: fix board remainder calculation --- client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index a5fb5bb..f71fb7d 100644 --- a/client.go +++ b/client.go @@ -100,7 +100,12 @@ func IndexGet(w http.ResponseWriter, r *http.Request, db *sql.DB) { data.Board.Actor = actor data.Board.Post.Actor = actor.Id data.Board.Restricted = actor.Restricted - data.BoardRemainer = make([]int, (len(data.Boards) % 3)+1) + //almost certainly there is a better algorithm for this but the old one was wrong + //and I suck at math. This works at least. + data.BoardRemainer = make([]int, 3-(len(data.Boards) % 3)) + if(len(data.BoardRemainer) == 3){ + data.BoardRemainer = make([]int, 0) + } data.InstanceIndex = GetCollectionFromReq("https://fchan.xyz/followers").Items data.NewsItems = getNewsFromDB(db, 3) -- cgit v1.2.3