From eb619b65444651f4ab3ff0f6a9671def2ca01882 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Tue, 27 May 2025 18:48:46 +0100 Subject: [PATCH] invites: fix /count routes both now filter for IsReferral == true, and a typo in /used was fixed. --- api-invites.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api-invites.go b/api-invites.go index 7c7e372..66e97fb 100644 --- a/api-invites.go +++ b/api-invites.go @@ -268,7 +268,7 @@ func (app *appContext) GenerateInvite(gc *gin.Context) { func (app *appContext) GetInviteCount(gc *gin.Context) { resp := PageCountDTO{} var err error - resp.Count, err = app.storage.db.Count(&Invite{}, &badgerhold.Query{}) + resp.Count, err = app.storage.db.Count(&Invite{}, badgerhold.Where("IsReferral").Eq(false)) if err != nil { resp.Count = 0 } @@ -284,7 +284,7 @@ func (app *appContext) GetInviteCount(gc *gin.Context) { func (app *appContext) GetInviteUsedCount(gc *gin.Context) { resp := PageCountDTO{} var err error - resp.Count, err = app.storage.db.Count(&Invite{}, badgerhold.Where("usedBy").MatchFunc(func(ra *badgerhold.RecordAccess) (bool, error) { + resp.Count, err = app.storage.db.Count(&Invite{}, badgerhold.Where("IsReferral").Eq(false).And("UsedBy").MatchFunc(func(ra *badgerhold.RecordAccess) (bool, error) { field := ra.Field() switch usedBy := field.(type) { case [][]string: