diff options
author | knotteye <knotteye@airmail.cc> | 2021-07-02 15:22:00 -0500 |
---|---|---|
committer | knotteye <knotteye@airmail.cc> | 2021-07-02 15:22:00 -0500 |
commit | fc8b4d6517213a371e26938ff2c0319d5e5f459a (patch) | |
tree | 425f63e8182bf5a00c0bbb4934108611e741a24d | |
parent | fab8de7187571a4f3f8a30966057d661a858b645 (diff) |
fix board remainder calculation
-rw-r--r-- | client.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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) |