use sql count for task_run with the new tests