mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
FEAT[BE]: add default filterby become so_date in report markeing
This commit is contained in:
@@ -225,8 +225,12 @@ func (r *MarketingDeliveryProductRepositoryImpl) GetAllWithFilters(ctx context.C
|
||||
}
|
||||
}
|
||||
|
||||
if filters.FilterBy != "" && (filters.StartDate != "" || filters.EndDate != "") {
|
||||
if filters.FilterBy == "so_date" {
|
||||
if filters.StartDate != "" || filters.EndDate != "" {
|
||||
filterBy := filters.FilterBy
|
||||
if filterBy == "" {
|
||||
filterBy = "so_date"
|
||||
}
|
||||
if filterBy == "so_date" {
|
||||
if filters.StartDate != "" {
|
||||
if startDate, err := utils.ParseDateString(filters.StartDate); err == nil {
|
||||
db = db.Where("marketings.so_date >= ?", startDate)
|
||||
@@ -238,7 +242,7 @@ func (r *MarketingDeliveryProductRepositoryImpl) GetAllWithFilters(ctx context.C
|
||||
db = db.Where("marketings.so_date < ?", nextDate)
|
||||
}
|
||||
}
|
||||
} else if filters.FilterBy == "realization_date" {
|
||||
} else if filterBy == "realization_date" {
|
||||
if filters.StartDate != "" {
|
||||
if startDate, err := utils.ParseDateString(filters.StartDate); err == nil {
|
||||
db = db.Where("marketing_delivery_products.delivery_date >= ?", startDate)
|
||||
|
||||
@@ -175,7 +175,6 @@ func (s *repportService) GetMarketing(c *fiber.Ctx, params *validation.Marketing
|
||||
for customerID := range customerGroups {
|
||||
transactions, err := s.CustomerPaymentRepo.GetCustomerPaymentTransactions(c.Context(), &customerID)
|
||||
if err != nil {
|
||||
s.Log.Warnf("Failed to get transactions for customer %d: %v", customerID, err)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user