original_string: protected function get_unkept_assessments($assessments, $newallocations, $keepselfassessments) {
          $keepids = array(); // keep these assessments
          foreach ($assessments as $assessmentid => $assessment) {
              $aaid = $assessment->authorid;
              $arid = $assessment->reviewerid;
              if (($keepselfassessments) && ($aaid == $arid)) {
                  $keepids[$assessmentid] = null;
                  continue;
              }
              foreach ($newallocations as $newallocation) {
                  $nrid = key($newallocation);
                  $naid = current($newallocation);
                  if (array($arid, $aaid) == array($nrid, $naid)) {
                      // re-allocation found - let us continue with the next assessment
                      $keepids[$assessmentid] = null;
                      continue 2;
                  }
              }
          }
          return array_keys(array_diff_key($assessments, $keepids));
      }
code: protected function get_unkept_assessments($assessments, $newallocations, $keepselfassessments) {
          $keepids = array(); // keep these assessments
          foreach ($assessments as $assessmentid => $assessment) {
              $aaid = $assessment->authorid;
              $arid = $assessment->reviewerid;
              if (($keepselfassessments) && ($aaid == $arid)) {
                  $keepids[$assessmentid] = null;
                  continue;
              }
              foreach ($newallocations as $newallocation) {
                  $nrid = key($newallocation);
                  $naid = current($newallocation);
                  if (array($arid, $aaid) == array($nrid, $naid)) {
                      // re-allocation found - let us continue with the next assessment
                      $keepids[$assessmentid] = null;
                      continue 2;
                  }
              }
          }
          return array_keys(array_diff_key($assessments, $keepids));
      }
code_tokens: protected function get_unkept_assessments ( $ assessments , $ newallocations , $ keepselfassessments ) { $ keepids = array ( ) ; // keep these assessments foreach ( $ assessments as $ assessmentid => $ assessment ) { $ aaid = $ assessment -> authorid ; $ arid = $ assessment -> reviewerid ; if ( ( $ keepselfassessments ) && ( $ aaid == $ arid ) ) { $ keepids [ $ assessmentid ] = null ; continue ; } foreach ( $ newallocations as $ newallocation ) { $ nrid = key ( $ newallocation ) ; $ naid = current ( $ newallocation ) ; if ( array ( $ arid , $ aaid ) == array ( $ nrid , $ naid ) ) { // re-allocation found - let us continue with the next assessment $ keepids [ $ assessmentid ] = null ; continue 2 ; } } } return array_keys ( array_diff_key ( $ assessments , $ keepids ) ) ; }
docstring: Returns the list of assessments to remove
  
  If user selects "removecurrentallocations", we should remove all current assessment records
  and insert new ones. But this would needlessly waste table ids. Instead, let us find only those
  assessments that have not been re-allocated in this run of allocation. So, the once-allocated
  submissions are kept with their original id.
  
  @param array $assessments         list of current assessments
  @param mixed $newallocations      array of 'reviewerid' => 'authorid' pairs
  @param bool  $keepselfassessments do not remove already allocated self assessments
  @return array of assessments ids to be removed
docstring_tokens: Returns the list of assessments to remove