original_string: public function save_quickgrading_changes($userid, $grade) {
          global $DB;
          $feedbackcomment = $this->get_feedback_comments($grade->id);
          $quickgradecomments = optional_param('quickgrade_comments_' . $userid, null, PARAM_RAW);
          if (!$quickgradecomments && $quickgradecomments !== '') {
              return true;
          }
          if ($feedbackcomment) {
              $feedbackcomment->commenttext = $quickgradecomments;
              return $DB->update_record('assignfeedback_comments', $feedbackcomment);
          } else {
              $feedbackcomment = new stdClass();
              $feedbackcomment->commenttext = $quickgradecomments;
              $feedbackcomment->commentformat = FORMAT_HTML;
              $feedbackcomment->grade = $grade->id;
              $feedbackcomment->assignment = $this->assignment->get_instance()->id;
              return $DB->insert_record('assignfeedback_comments', $feedbackcomment) > 0;
          }
      }
code: public function save_quickgrading_changes($userid, $grade) {
          global $DB;
          $feedbackcomment = $this->get_feedback_comments($grade->id);
          $quickgradecomments = optional_param('quickgrade_comments_' . $userid, null, PARAM_RAW);
          if (!$quickgradecomments && $quickgradecomments !== '') {
              return true;
          }
          if ($feedbackcomment) {
              $feedbackcomment->commenttext = $quickgradecomments;
              return $DB->update_record('assignfeedback_comments', $feedbackcomment);
          } else {
              $feedbackcomment = new stdClass();
              $feedbackcomment->commenttext = $quickgradecomments;
              $feedbackcomment->commentformat = FORMAT_HTML;
              $feedbackcomment->grade = $grade->id;
              $feedbackcomment->assignment = $this->assignment->get_instance()->id;
              return $DB->insert_record('assignfeedback_comments', $feedbackcomment) > 0;
          }
      }
code_tokens: public function save_quickgrading_changes ( $ userid , $ grade ) { global $ DB ; $ feedbackcomment = $ this -> get_feedback_comments ( $ grade -> id ) ; $ quickgradecomments = optional_param ( 'quickgrade_comments_' . $ userid , null , PARAM_RAW ) ; if ( ! $ quickgradecomments && $ quickgradecomments !== '' ) { return true ; } if ( $ feedbackcomment ) { $ feedbackcomment -> commenttext = $ quickgradecomments ; return $ DB -> update_record ( 'assignfeedback_comments' , $ feedbackcomment ) ; } else { $ feedbackcomment = new stdClass ( ) ; $ feedbackcomment -> commenttext = $ quickgradecomments ; $ feedbackcomment -> commentformat = FORMAT_HTML ; $ feedbackcomment -> grade = $ grade -> id ; $ feedbackcomment -> assignment = $ this -> assignment -> get_instance ( ) -> id ; return $ DB -> insert_record ( 'assignfeedback_comments' , $ feedbackcomment ) > 0 ; } }
docstring: Save quickgrading changes.
  
  @param int $userid The user id in the table this quickgrading element relates to
  @param stdClass $grade The grade
  @return boolean - true if the grade changes were saved correctly
docstring_tokens: Save quickgrading changes .