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
@@ -260,7 +260,7 @@ func (r *RecordingRepositoryImpl) GetProgressRows(ctx context.Context, startDate
'Recordings' AS module,
COALESCE(pf.flock_name, loc.name, 'Unknown Farm') AS farm_name,
COALESCE(k.name, `+unassignedSQL+`, 'Unknown Kandang') AS kandang_name,
DATE(r.record_datetime) AS activity_date,
CAST(DATE(r.record_datetime) AS TEXT) AS activity_date,
COUNT(*) AS count
`).
Joins("JOIN project_flock_kandangs pfk ON pfk.id = r.project_flock_kandangs_id").
@@ -296,7 +296,7 @@ func (r *RecordingRepositoryImpl) 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
}