fix: internal server error because of date parsing

This commit is contained in:
Adnan Zahir
2026-04-21 21:41:54 +07:00
parent 5e7c51e9c2
commit e91c45ee50
5 changed files with 36 additions and 8 deletions
@@ -141,7 +141,7 @@ func (r *ExpenseRepositoryImpl) GetProgressRows(ctx context.Context, startDate,
'Expenses' AS module,
COALESCE(pf.flock_name, loc.name, fallback_loc.name, 'Unknown Farm') AS farm_name,
COALESCE(k.name, `+unassignedSQL+`, 'Unknown Kandang') AS kandang_name,
DATE(e.transaction_date) AS activity_date,
CAST(DATE(e.transaction_date) AS TEXT) AS activity_date,
COUNT(*) AS count
`).
Joins("LEFT JOIN (SELECT DISTINCT expense_id, project_flock_kandang_id, kandang_id FROM expense_nonstocks) en ON en.expense_id = e.id").
@@ -179,7 +179,7 @@ func (r *ExpenseRepositoryImpl) GetProgressRows(ctx context.Context, startDate,
rows := make([]exportprogress.Row, 0, len(scanned))
for _, item := range scanned {
activityDate, err := time.Parse("2006-01-02", item.ActivityDate)
activityDate, err := exportprogress.ParseActivityDate(item.ActivityDate)
if err != nil {
return nil, err
}