original_string: public static function get_uniqueid_for_user_static($assignid, $userid) {
          global $DB;
  
          // Search for a record.
          $params = array('assignment'=>$assignid, 'userid'=>$userid);
          if ($record = $DB->get_record('assign_user_mapping', $params, 'id')) {
              return $record->id;
          }
  
          // Be a little smart about this - there is no record for the current user.
          // We should ensure any unallocated ids for the current participant
          // list are distrubited randomly.
          self::allocate_unique_ids($assignid);
  
          // Retry the search for a record.
          if ($record = $DB->get_record('assign_user_mapping', $params, 'id')) {
              return $record->id;
          }
  
          // The requested user must not be a participant. Add a record anyway.
          $record = new stdClass();
          $record->assignment = $assignid;
          $record->userid = $userid;
  
          return $DB->insert_record('assign_user_mapping', $record);
      }
code: public static function get_uniqueid_for_user_static($assignid, $userid) {
          global $DB;
  
          // Search for a record.
          $params = array('assignment'=>$assignid, 'userid'=>$userid);
          if ($record = $DB->get_record('assign_user_mapping', $params, 'id')) {
              return $record->id;
          }
  
          // Be a little smart about this - there is no record for the current user.
          // We should ensure any unallocated ids for the current participant
          // list are distrubited randomly.
          self::allocate_unique_ids($assignid);
  
          // Retry the search for a record.
          if ($record = $DB->get_record('assign_user_mapping', $params, 'id')) {
              return $record->id;
          }
  
          // The requested user must not be a participant. Add a record anyway.
          $record = new stdClass();
          $record->assignment = $assignid;
          $record->userid = $userid;
  
          return $DB->insert_record('assign_user_mapping', $record);
      }
code_tokens: public static function get_uniqueid_for_user_static ( $ assignid , $ userid ) { global $ DB ; // Search for a record. $ params = array ( 'assignment' => $ assignid , 'userid' => $ userid ) ; if ( $ record = $ DB -> get_record ( 'assign_user_mapping' , $ params , 'id' ) ) { return $ record -> id ; } // Be a little smart about this - there is no record for the current user. // We should ensure any unallocated ids for the current participant // list are distrubited randomly. self :: allocate_unique_ids ( $ assignid ) ; // Retry the search for a record. if ( $ record = $ DB -> get_record ( 'assign_user_mapping' , $ params , 'id' ) ) { return $ record -> id ; } // The requested user must not be a participant. Add a record anyway. $ record = new stdClass ( ) ; $ record -> assignment = $ assignid ; $ record -> userid = $ userid ; return $ DB -> insert_record ( 'assign_user_mapping' , $ record ) ; }
docstring: Lookup this user id and return the unique id for this assignment.
  
  @param int $assignid The assignment id
  @param int $userid The userid to lookup
  @return int The unique id
docstring_tokens: Lookup this user id and return the unique id for this assignment .