original_string: protected function get_group_and_submission($userid, &$group, &$submission, $attemptnumber) {
          $group = false;
          if (isset($this->submissiongroups[$userid])) {
              $group = $this->submissiongroups[$userid];
          } else {
              $group = $this->assignment->get_submission_group($userid, false);
              $this->submissiongroups[$userid] = $group;
          }
  
          $groupid = 0;
          if ($group) {
              $groupid = $group->id;
          }
  
          // Static cache is keyed by groupid and attemptnumber.
          // We may need both the latest and previous attempt in the same page.
          if (isset($this->groupsubmissions[$groupid . ':' . $attemptnumber])) {
              $submission = $this->groupsubmissions[$groupid . ':' . $attemptnumber];
          } else {
              $submission = $this->assignment->get_group_submission($userid, $groupid, false, $attemptnumber);
              $this->groupsubmissions[$groupid . ':' . $attemptnumber] = $submission;
          }
      }
code: protected function get_group_and_submission($userid, &$group, &$submission, $attemptnumber) {
          $group = false;
          if (isset($this->submissiongroups[$userid])) {
              $group = $this->submissiongroups[$userid];
          } else {
              $group = $this->assignment->get_submission_group($userid, false);
              $this->submissiongroups[$userid] = $group;
          }
  
          $groupid = 0;
          if ($group) {
              $groupid = $group->id;
          }
  
          // Static cache is keyed by groupid and attemptnumber.
          // We may need both the latest and previous attempt in the same page.
          if (isset($this->groupsubmissions[$groupid . ':' . $attemptnumber])) {
              $submission = $this->groupsubmissions[$groupid . ':' . $attemptnumber];
          } else {
              $submission = $this->assignment->get_group_submission($userid, $groupid, false, $attemptnumber);
              $this->groupsubmissions[$groupid . ':' . $attemptnumber] = $submission;
          }
      }
code_tokens: protected function get_group_and_submission ( $ userid , & $ group , & $ submission , $ attemptnumber ) { $ group = false ; if ( isset ( $ this -> submissiongroups [ $ userid ] ) ) { $ group = $ this -> submissiongroups [ $ userid ] ; } else { $ group = $ this -> assignment -> get_submission_group ( $ userid , false ) ; $ this -> submissiongroups [ $ userid ] = $ group ; } $ groupid = 0 ; if ( $ group ) { $ groupid = $ group -> id ; } // Static cache is keyed by groupid and attemptnumber. // We may need both the latest and previous attempt in the same page. if ( isset ( $ this -> groupsubmissions [ $ groupid . ':' . $ attemptnumber ] ) ) { $ submission = $ this -> groupsubmissions [ $ groupid . ':' . $ attemptnumber ] ; } else { $ submission = $ this -> assignment -> get_group_submission ( $ userid , $ groupid , false , $ attemptnumber ) ; $ this -> groupsubmissions [ $ groupid . ':' . $ attemptnumber ] = $ submission ; } }
docstring: Use a static cache to try and reduce DB calls.
  
  @param int $userid The user id for this submission
  @param int $group The groupid (returned)
  @param stdClass|false $submission The stdClass submission or false (returned)
  @param int $attemptnumber Return a specific attempt number (-1 for latest)
docstring_tokens: Use a static cache to try and reduce DB calls .