aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorknotteye <knotteye@airmail.cc>2021-07-02 15:22:00 -0500
committerknotteye <knotteye@airmail.cc>2021-07-02 15:22:00 -0500
commitfc8b4d6517213a371e26938ff2c0319d5e5f459a (patch)
tree425f63e8182bf5a00c0bbb4934108611e741a24d /client.go
parentfab8de7187571a4f3f8a30966057d661a858b645 (diff)
fix board remainder calculation
Diffstat (limited to 'client.go')
-rw-r--r--client.go7
1 files changed, 6 insertions, 1 deletions
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)