mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-47740' of git://github.com/timhunt/moodle
This commit is contained in:
commit
bdb319a5b1
3 changed files with 49 additions and 4 deletions
|
@ -867,6 +867,7 @@ ORDER BY
|
|||
public function update_question_attempt(question_attempt $qa) {
|
||||
$record = new stdClass();
|
||||
$record->id = $qa->get_database_id();
|
||||
$record->variant = $qa->get_variant();
|
||||
$record->maxmark = $qa->get_max_mark();
|
||||
$record->minfraction = $qa->get_min_fraction();
|
||||
$record->maxfraction = $qa->get_max_fraction();
|
||||
|
|
|
@ -1178,6 +1178,9 @@ class question_attempt {
|
|||
if ($pendingstep->response_summary_changed()) {
|
||||
$this->responsesummary = $pendingstep->get_new_response_summary();
|
||||
}
|
||||
if ($pendingstep->variant_number_changed()) {
|
||||
$this->variant = $pendingstep->get_new_variant_number();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -432,15 +432,23 @@ class question_attempt_step {
|
|||
|
||||
|
||||
/**
|
||||
* A subclass with a bit of additional funcitonality, for pending steps.
|
||||
* A subclass of {@link question_attempt_step} used when processing a new submission.
|
||||
*
|
||||
* When we are processing some new submitted data, which may or may not lead to
|
||||
* a new step being added to the {@link question_usage_by_activity} we create an
|
||||
* instance of this class. which is then passed to the question behaviour and question
|
||||
* type for processing. At the end of processing we then may, or may not, keep it.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_attempt_pending_step extends question_attempt_step {
|
||||
/** @var string . */
|
||||
/** @var string the new response summary, if there is one. */
|
||||
protected $newresponsesummary = null;
|
||||
|
||||
/** @var int the new variant number, if there is one. */
|
||||
protected $newvariant = null;
|
||||
|
||||
/**
|
||||
* If as a result of processing this step, the response summary for the
|
||||
* question attempt should changed, you should call this method to set the
|
||||
|
@ -451,15 +459,48 @@ class question_attempt_pending_step extends question_attempt_step {
|
|||
$this->newresponsesummary = $responsesummary;
|
||||
}
|
||||
|
||||
/** @return string the new response summary, if any. */
|
||||
/**
|
||||
* Get the new response summary, if there is one.
|
||||
* @return string the new response summary, or null if it has not changed.
|
||||
*/
|
||||
public function get_new_response_summary() {
|
||||
return $this->newresponsesummary;
|
||||
}
|
||||
|
||||
/** @return string whether this step changes the response summary. */
|
||||
/**
|
||||
* Whether this processing this step has changed the response summary.
|
||||
* @return bool true if there is a new response summary.
|
||||
*/
|
||||
public function response_summary_changed() {
|
||||
return !is_null($this->newresponsesummary);
|
||||
}
|
||||
|
||||
/**
|
||||
* If as a result of processing this step, you identify that this variant of the
|
||||
* question is acutally identical to the another one, you may change the
|
||||
* variant number recorded, in order to give better statistics. For an example
|
||||
* see qbehaviour_opaque.
|
||||
* @param int $variant the new variant number.
|
||||
*/
|
||||
public function set_new_variant_number($variant) {
|
||||
$this->newvariant = $variant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the new variant number, if there is one.
|
||||
* @return int the new variant number, or null if it has not changed.
|
||||
*/
|
||||
public function get_new_variant_number() {
|
||||
return $this->newvariant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this processing this step has changed the variant number.
|
||||
* @return bool true if there is a new variant number.
|
||||
*/
|
||||
public function variant_number_changed() {
|
||||
return !is_null($this->newvariant);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue