Added named function for ordering tasks based on completed_at or created_at