original_string: protected function add_new_allocations(array $newallocations, array $dataauthors, array $datareviewers) {
          global $DB;
  
          $newallocations = $this->get_unique_allocations($newallocations);
          $authorids      = $this->get_author_ids($newallocations);
          $submissions    = $this->workshop->get_submissions($authorids);
          $submissions    = $this->index_submissions_by_authors($submissions);
          foreach ($newallocations as $newallocation) {
              $reviewerid = key($newallocation);
              $authorid = current($newallocation);
              if (!isset($submissions[$authorid])) {
                  throw new moodle_exception('unabletoallocateauthorwithoutsubmission', 'workshop');
              }
              $submission = $submissions[$authorid];
              $status = $this->workshop->add_allocation($submission, $reviewerid, 1, true);   // todo configurable weight?
              if (workshop::ALLOCATION_EXISTS == $status) {
                  debugging('newallocations array contains existing allocation, this should not happen');
              }
          }
      }
code: protected function add_new_allocations(array $newallocations, array $dataauthors, array $datareviewers) {
          global $DB;
  
          $newallocations = $this->get_unique_allocations($newallocations);
          $authorids      = $this->get_author_ids($newallocations);
          $submissions    = $this->workshop->get_submissions($authorids);
          $submissions    = $this->index_submissions_by_authors($submissions);
          foreach ($newallocations as $newallocation) {
              $reviewerid = key($newallocation);
              $authorid = current($newallocation);
              if (!isset($submissions[$authorid])) {
                  throw new moodle_exception('unabletoallocateauthorwithoutsubmission', 'workshop');
              }
              $submission = $submissions[$authorid];
              $status = $this->workshop->add_allocation($submission, $reviewerid, 1, true);   // todo configurable weight?
              if (workshop::ALLOCATION_EXISTS == $status) {
                  debugging('newallocations array contains existing allocation, this should not happen');
              }
          }
      }
code_tokens: protected function add_new_allocations ( array $ newallocations , array $ dataauthors , array $ datareviewers ) { global $ DB ; $ newallocations = $ this -> get_unique_allocations ( $ newallocations ) ; $ authorids = $ this -> get_author_ids ( $ newallocations ) ; $ submissions = $ this -> workshop -> get_submissions ( $ authorids ) ; $ submissions = $ this -> index_submissions_by_authors ( $ submissions ) ; foreach ( $ newallocations as $ newallocation ) { $ reviewerid = key ( $ newallocation ) ; $ authorid = current ( $ newallocation ) ; if ( ! isset ( $ submissions [ $ authorid ] ) ) { throw new moodle_exception ( 'unabletoallocateauthorwithoutsubmission' , 'workshop' ) ; } $ submission = $ submissions [ $ authorid ] ; $ status = $ this -> workshop -> add_allocation ( $ submission , $ reviewerid , 1 , true ) ; // todo configurable weight? if ( workshop :: ALLOCATION_EXISTS == $ status ) { debugging ( 'newallocations array contains existing allocation, this should not happen' ) ; } } }
docstring: Creates new assessment records
  
  @param array $newallocations pairs 'reviewerid' => 'authorid'
  @param array $dataauthors    authors by group, group [0] contains all authors
  @param array $datareviewers  reviewers by group, group [0] contains all reviewers
  @return bool
docstring_tokens: Creates new assessment records