original_string: public function update_slot_maxmark($slot, $maxmark) {
          global $DB;
  
          if (abs($maxmark - $slot->maxmark) < 1e-7) {
              // Grade has not changed. Nothing to do.
              return false;
          }
  
          $trans = $DB->start_delegated_transaction();
          $slot->maxmark = $maxmark;
          $DB->update_record('quiz_slots', $slot);
          \question_engine::set_max_mark_in_attempts(new \qubaids_for_quiz($slot->quizid),
                  $slot->slot, $maxmark);
          $trans->allow_commit();
  
          return true;
      }
code: public function update_slot_maxmark($slot, $maxmark) {
          global $DB;
  
          if (abs($maxmark - $slot->maxmark) < 1e-7) {
              // Grade has not changed. Nothing to do.
              return false;
          }
  
          $trans = $DB->start_delegated_transaction();
          $slot->maxmark = $maxmark;
          $DB->update_record('quiz_slots', $slot);
          \question_engine::set_max_mark_in_attempts(new \qubaids_for_quiz($slot->quizid),
                  $slot->slot, $maxmark);
          $trans->allow_commit();
  
          return true;
      }
code_tokens: public function update_slot_maxmark ( $ slot , $ maxmark ) { global $ DB ; if ( abs ( $ maxmark - $ slot -> maxmark ) < 1e-7 ) { // Grade has not changed. Nothing to do. return false ; } $ trans = $ DB -> start_delegated_transaction ( ) ; $ slot -> maxmark = $ maxmark ; $ DB -> update_record ( 'quiz_slots' , $ slot ) ; \ question_engine :: set_max_mark_in_attempts ( new \ qubaids_for_quiz ( $ slot -> quizid ) , $ slot -> slot , $ maxmark ) ; $ trans -> allow_commit ( ) ; return true ; }
docstring: Change the max mark for a slot.
  
  Saves changes to the question grades in the quiz_slots table and any
  corresponding question_attempts.
  It does not update 'sumgrades' in the quiz table.
  
  @param \stdClass $slot row from the quiz_slots table.
  @param float $maxmark the new maxmark.
  @return bool true if the new grade is different from the old one.
docstring_tokens: Change the max mark for a slot .