only consider a contest as ended if the last phase it was in has a closed or finished status
further improvements at unit testing