The devlog-ist/landing project focuses on creating landing pages. A recent update addressed an issue with the staggered scheduling feature. Previously, scheduled posts were not displaying correctly in the Filament table due to a failure to update the Post.scheduled_for column.
The Problem: Incomplete Data
The scheduleStaggered() function was creating ScheduledPost records as expected, but it wasn't updating the corresponding Post record with the scheduled time. This resulted in an empty "Scheduled For" field in the Filament admin panel, causing confusion and hindering content management.
The Solution: Updating the Post Record
The fix involved ensuring that the Post.scheduled_for column is correctly updated when a post is scheduled using the staggered scheduling feature. This ensures that the scheduled time is accurately reflected in the Filament table.
To illustrate, consider this simplified example. The original (faulty) logic might have looked like this (in Go):
// Incorrect
func scheduleStaggered(post Post, scheduleTimes []time.Time) {
for _, t := range scheduleTimes {
// Create ScheduledPost record
createScheduledPost(post, t)
// Missing: Update Post.scheduled_for
}
}
The corrected logic now includes the necessary update:
// Corrected
func scheduleStaggered(post Post, scheduleTimes []time.Time) {
for _, t := range scheduleTimes {
// Create ScheduledPost record
createScheduledPost(post, t)
// Update Post.scheduled_for
post.ScheduledFor = &t
updatePost(post)
}
}
The Result: Accurate Scheduling Information
By ensuring that the Post.scheduled_for column is properly updated, the Filament table now accurately displays the scheduled time for posts created using the staggered scheduling feature. This provides a clear and reliable overview of scheduled content, improving content management workflows.
Top comments (0)