From a09aa6ff7c7d5c27e243aab2ee9fdbc68d5850d0 Mon Sep 17 00:00:00 2001 From: elraphty Date: Thu, 8 Feb 2024 19:44:26 +0100 Subject: [PATCH] tested unique paid hunters --- db/metrics.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/metrics.go b/db/metrics.go index c8571771f..621c8989b 100644 --- a/db/metrics.go +++ b/db/metrics.go @@ -59,7 +59,9 @@ func (db database) TotalPaidBounties(r PaymentDateRange) int64 { func (db database) TotalHuntersPaid(r PaymentDateRange) int64 { var count int64 - db.db.Model(&Bounty{}).Select("DISTINCT assignee").Where("assignee != ''").Where("paid = ?", true).Where("created >= ?", r.StartDate).Where("created <= ?", r.EndDate).Count(&count) + query := fmt.Sprintf(`SELECT COUNT(DISTINCT assignee) FROM bounty WHERE assignee !='' AND paid=true AND created >= %s AND created <= %s`, r.StartDate, r.EndDate) + + db.db.Raw(query).Count(&count) return count }