invites: fix /count routes
both now filter for IsReferral == true, and a typo in /used was fixed.
This commit is contained in:
+2
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user