added a updateTotal function that counts the Pending and Complited list items