Skip to content

Commit f46f8ab

Browse files
Merge pull request #92 from wiris/v4.12.1
V4.12.1
2 parents 4b1edba + 37ef62d commit f46f8ab

File tree

5 files changed

+19
-34
lines changed

5 files changed

+19
-34
lines changed

quizzes/lib/com/wiris/quizzes/impl/QuizzesImpl.class.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ public function newFeedbackRequest($html, $instance) {
10591059
$r = $this->newGradeRequest($instance);
10601060
$qr = $r;
10611061
$qi = $instance;
1062-
$qr->question = $this->cloneQuestion($qr->question);
1062+
$qr->question = $this->shallowCopyQuestion($qr->question);
10631063
com_wiris_quizzes_impl_QuizzesImpl::setVariables($html, $qr->question, $qi, $qr);
10641064
return $r;
10651065
}
@@ -1114,21 +1114,12 @@ public function newVariablesRequestWithQuestionData($html, $instance) {
11141114
}
11151115
return $this->newVariablesRequest($sb->b, $instance);
11161116
}
1117-
public function sanitizeForQuizzesService($question) {
1118-
$slots = $question->getSlots();
1119-
{
1120-
$_g = 0;
1121-
while($_g < $slots->length) {
1122-
$slot = $slots[$_g];
1123-
++$_g;
1124-
if($slot->getSyntax()->getName() == com_wiris_quizzes_api_assertion_SyntaxName::$MATH_MULTISTEP) {
1125-
$slot->setSyntax(com_wiris_quizzes_api_assertion_SyntaxName::$MATH);
1126-
}
1127-
unset($slot);
1128-
}
1129-
}
1117+
public function shallowCopyQuestion($question) {
1118+
$copy = new com_wiris_quizzes_impl_QuestionImpl();
1119+
$copy->importQuestion($question->getImpl());
1120+
return $copy;
11301121
}
1131-
public function cloneQuestion($question) {
1122+
public function deepCopyQuestion($question) {
11321123
$serialized = $question->serialize();
11331124
return $this->readQuestion($serialized);
11341125
}
@@ -1141,12 +1132,11 @@ public function newVariablesRequest($html, $instance) {
11411132
if($question === null) {
11421133
throw new HException("The question must be specified, either as a parameter" . " of this function or as a field of the question instance");
11431134
}
1144-
$question = $this->cloneQuestion($question);
1135+
$question = $this->shallowCopyQuestion($question);
11451136
$qr = new com_wiris_quizzes_impl_QuestionRequestImpl();
11461137
$qr->question = $question;
11471138
$qr->userData = $qi->userData;
11481139
com_wiris_quizzes_impl_QuizzesImpl::setVariables($html, $question, $qi, $qr);
1149-
$this->sanitizeForQuizzesService($question);
11501140
return $qr;
11511141
}
11521142
public function readQuestionInstance($xml, $q) {

quizzes/lib/quizzes.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2831,7 +2831,7 @@ com.wiris.quizzes.impl.QuizzesImpl.prototype = $extend(com.wiris.quizzes.api.Qui
28312831
var r = this.newGradeRequest(instance);
28322832
var qr = r;
28332833
var qi = instance;
2834-
qr.question = this.cloneQuestion(qr.question);
2834+
qr.question = this.shallowCopyQuestion(qr.question);
28352835
com.wiris.quizzes.impl.QuizzesImpl.setVariables(html,qr.question,qi,qr);
28362836
return r;
28372837
}
@@ -2865,16 +2865,12 @@ com.wiris.quizzes.impl.QuizzesImpl.prototype = $extend(com.wiris.quizzes.api.Qui
28652865
if(html != null) sb.b += Std.string(html);
28662866
return this.newVariablesRequest(sb.b,instance);
28672867
}
2868-
,sanitizeForQuizzesService: function(question) {
2869-
var slots = question.getSlots();
2870-
var _g = 0;
2871-
while(_g < slots.length) {
2872-
var slot = slots[_g];
2873-
++_g;
2874-
if(slot.getSyntax().getName() == com.wiris.quizzes.api.assertion.SyntaxName.MATH_MULTISTEP) slot.setSyntax(com.wiris.quizzes.api.assertion.SyntaxName.MATH);
2875-
}
2868+
,shallowCopyQuestion: function(question) {
2869+
var copy = new com.wiris.quizzes.impl.QuestionImpl();
2870+
copy.importQuestion(question.getImpl());
2871+
return copy;
28762872
}
2877-
,cloneQuestion: function(question) {
2873+
,deepCopyQuestion: function(question) {
28782874
var serialized = question.serialize();
28792875
return this.readQuestion(serialized);
28802876
}
@@ -2883,12 +2879,11 @@ com.wiris.quizzes.impl.QuizzesImpl.prototype = $extend(com.wiris.quizzes.api.Qui
28832879
var qi = instance;
28842880
var question = qi.question;
28852881
if(question == null) throw "The question must be specified, either as a parameter" + " of this function or as a field of the question instance";
2886-
question = this.cloneQuestion(question);
2882+
question = this.shallowCopyQuestion(question);
28872883
var qr = new com.wiris.quizzes.impl.QuestionRequestImpl();
28882884
qr.question = question;
28892885
qr.userData = qi.userData;
28902886
com.wiris.quizzes.impl.QuizzesImpl.setVariables(html,question,qi,qr);
2891-
this.sanitizeForQuizzesService(question);
28922887
return qr;
28932888
}
28942889
,readQuestionInstance: function(xml,q) {

quizzes/lib/util.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quizzes/lib/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.12.0.e19fce
1+
4.12.1.c0cc90

version.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
defined('MOODLE_INTERNAL') || die();
1818

19-
$plugin->version = 2024121900;
19+
$plugin->version = 2024121901;
2020
$plugin->requires = 2015111600; // Moodle 3.0.
21-
$plugin->release = '4.12.0';
21+
$plugin->release = '4.12.1';
2222
$plugin->maturity = MATURITY_STABLE;
2323
$plugin->component = 'qtype_wq';
2424
$plugin->dependencies = array(

0 commit comments

Comments
 (0)