#975 - refactor hasActiveVisit method