diff --git a/soul-api/internal/handler/match_records.go b/soul-api/internal/handler/match_records.go index 098dfd00..edc2212f 100644 --- a/soul-api/internal/handler/match_records.go +++ b/soul-api/internal/handler/match_records.go @@ -17,9 +17,9 @@ func DBMatchRecordsList(c *gin.Context) { if c.Query("stats") == "true" { var totalMatches int64 - db.Model(&model.MatchRecord{}).Count(&totalMatches) + db.Raw("SELECT COUNT(*) FROM match_records").Scan(&totalMatches) var todayMatches int64 - db.Model(&model.MatchRecord{}).Where("created_at >= CURDATE()").Count(&todayMatches) + db.Raw("SELECT COUNT(*) FROM match_records WHERE created_at >= CURDATE()").Scan(&todayMatches) type TypeCount struct { MatchType string `json:"matchType" gorm:"column:match_type"` Count int64 `json:"count" gorm:"column:count"`