You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Select("count(case when timestamp >= ? then 1 end) as current_requests, count(case when timestamp >= ? and timestamp < ? then 1 end) as previous_requests", tenMinutesAgo, twentyMinutesAgo, tenMinutesAgo).
197
-
Where("timestamp >= ?", twentyMinutesAgo).
197
+
Where("timestamp >= ? AND request_type = ?", twentyMinutesAgo, models.RequestTypeFinal).
Copy file name to clipboardExpand all lines: internal/handler/group_handler.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -782,13 +782,13 @@ func (s *Server) GetGroupStats(c *gin.Context) {
782
782
now:=time.Now()
783
783
oneHourAgo:=now.Add(-1*time.Hour)
784
784
785
-
iferr:=s.DB.Model(&models.RequestLog{}).Where("group_id = ? AND timestamp BETWEEN ? AND ?", groupID, oneHourAgo, now).Count(&total).Error; err!=nil {
785
+
iferr:=s.DB.Model(&models.RequestLog{}).Where("group_id = ? AND timestamp BETWEEN ? AND ? AND request_type = ?", groupID, oneHourAgo, now, models.RequestTypeFinal).Count(&total).Error; err!=nil {
786
786
mu.Lock()
787
787
errors=append(errors, fmt.Errorf("failed to get hourly total requests: %w", err))
788
788
mu.Unlock()
789
789
return
790
790
}
791
-
iferr:=s.DB.Model(&models.RequestLog{}).Where("group_id = ? AND timestamp BETWEEN ? AND ? AND is_success = ?", groupID, oneHourAgo, now, false).Count(&failed).Error; err!=nil {
791
+
iferr:=s.DB.Model(&models.RequestLog{}).Where("group_id = ? AND timestamp BETWEEN ? AND ? AND is_success = ? AND request_type = ?", groupID, oneHourAgo, now, false, models.RequestTypeFinal).Count(&failed).Error; err!=nil {
792
792
mu.Lock()
793
793
errors=append(errors, fmt.Errorf("failed to get hourly failed requests: %w", err))
0 commit comments