Change inverted zones logic to server side teachers_helper function