working sort_by for tasks