diff --git a/internal/repository/analytics_repository.go b/internal/repository/analytics_repository.go index e1980ae..59c7ad2 100644 --- a/internal/repository/analytics_repository.go +++ b/internal/repository/analytics_repository.go @@ -142,7 +142,7 @@ func (r *AnalyticsRepositoryImpl) GetProductAnalytics(ctx context.Context, organ err := query. Group("p.id, p.name, c.id, c.name"). - Order("c.name ASC, revenue DESC"). + Order("p.name ASC"). Limit(limit). Scan(&results).Error @@ -178,7 +178,7 @@ func (r *AnalyticsRepositoryImpl) GetProductAnalyticsPerCategory(ctx context.Con err := query. Group("c.id, c.name"). - Order("total_revenue DESC"). + Order("c.name ASC"). Scan(&results).Error return results, err @@ -353,7 +353,7 @@ func (r *AnalyticsRepositoryImpl) GetProfitLossAnalytics(ctx context.Context, or Where("oi.status != ?", entities.OrderItemStatusCancelled). Where("o.created_at >= ? AND o.created_at <= ?", dateFrom, dateTo). Group("p.id, p.name, c.id, c.name"). - Order("c.name ASC, gross_profit DESC"). + Order("p.name ASC"). Limit(1000) if outletID != nil {