original_string: public function mark_complete($userid) {
          global $DB;
          $obj = array();
          $obj['critid'] = $this->id;
          $obj['userid'] = $userid;
          $obj['datemet'] = time();
          if (!$DB->record_exists('badge_criteria_met', array('critid' => $this->id, 'userid' => $userid))) {
              $DB->insert_record('badge_criteria_met', $obj);
          }
      }
code: public function mark_complete($userid) {
          global $DB;
          $obj = array();
          $obj['critid'] = $this->id;
          $obj['userid'] = $userid;
          $obj['datemet'] = time();
          if (!$DB->record_exists('badge_criteria_met', array('critid' => $this->id, 'userid' => $userid))) {
              $DB->insert_record('badge_criteria_met', $obj);
          }
      }
code_tokens: public function mark_complete ( $ userid ) { global $ DB ; $ obj = array ( ) ; $ obj [ 'critid' ] = $ this -> id ; $ obj [ 'userid' ] = $ userid ; $ obj [ 'datemet' ] = time ( ) ; if ( ! $ DB -> record_exists ( 'badge_criteria_met' , array ( 'critid' => $ this -> id , 'userid' => $ userid ) ) ) { $ DB -> insert_record ( 'badge_criteria_met' , $ obj ) ; } }
docstring: Mark this criteria as complete for a user
  
  @param int $userid User whose criteria is completed.
docstring_tokens: Mark this criteria as complete for a user