Sort tasks by completion status