Skip to content

Commit 87c0052

Browse files
Merge pull request wiris#89 from wiris/v4.11.5
V4.11.5
2 parents f5148c6 + 3b681d4 commit 87c0052

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed

lang/en/qtype_wq.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@
107107
$string['auxiliar_text'] = 'Write an optional reasoning for your answer:';
108108

109109
$string['log_server_errors'] = 'Log server errors';
110-
$string['log_server_errors_help'] = 'Extensively log errors coming from the WirisQuizzes service to your server logs. This might cause an increase in the size of your log files but might help the Wiris team troubleshoot issues.';
110+
$string['log_server_errors_help'] = 'Extensively log errors coming from the WirisQuizzes service and other errors occurred when processing WirisQuizzes questions to your server logs. This might cause an increase in the size of your log files but might help the Wiris team troubleshoot issues.';

question.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ public function format_text($text, $format, $qa, $component, $filearea, $itemid,
172172
$format = FORMAT_HTML;
173173
}
174174
$text = $this->expand_variables($text);
175+
175176
return $this->base->format_text($text, $format, $qa, $component, $filearea, $itemid, $clean);
176177
}
177178

@@ -384,6 +385,7 @@ public function call_wiris_service($request) {
384385
}
385386

386387
if ($islogmodeenabled) {
388+
// @codingStandardsIgnoreLine
387389
error_log('WIRISQUIZZES SERVER ERROR --- REQUEST: --- ' . $request->serialize());
388390
}
389391

step.php

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
defined('MOODLE_INTERNAL') || die();
3737

3838
class qtype_wirisstep {
39-
const MAX_ATTEMPS_SHORTANSWER_WIRIS = 2;
39+
const MAX_ATTEMPS_SHORTANSWER_WIRIS = 5;
4040

41-
private $step;
41+
private ?question_attempt_step $step;
4242
private $stepid;
4343
private $extraprefix;
4444

@@ -183,13 +183,8 @@ public function get_qt_data() {
183183
$DB = $this->get_db();
184184
}
185185
}
186-
/**
187-
*
188-
* @param type $name
189-
* @param type $subquesbool whether the variable is from the subquestion or the parent (only cloze).
190-
* @return null
191-
*/
192-
public function get_var($name, $subquesbool = true) {
186+
187+
public function get_var(string $name, bool $subquesbool = true) {
193188
$name = $this->trim_name($name, $subquesbool);
194189

195190
if ($subquesbool && $this->step != null) {
@@ -256,17 +251,38 @@ public function is_attempt_limit_reached() {
256251
if (is_null($c)) {
257252
return false;
258253
}
259-
return $c >= self::MAX_ATTEMPS_SHORTANSWER_WIRIS;
254+
255+
$isreached = $c >= self::MAX_ATTEMPS_SHORTANSWER_WIRIS;
256+
257+
$islogmodeenabled = get_config('qtype_wq', 'log_server_errors') == '1';
258+
if ($islogmodeenabled) {
259+
$errormessage = 'WIRISQUIZZES ATTEMPT LIMIT REACHED FOR STEP WITH ID ' .
260+
($this->step != null ? $this->step->get_id() : $this->stepid);
261+
// @codingStandardsIgnoreLine
262+
error_log($errormessage);
263+
}
264+
265+
return $isreached;
260266
}
261267

262268
/**
263269
* Increment number of failed attempts
264270
*/
265-
public function inc_attempts() {
271+
public function inc_attempts(moodle_exception $e) {
266272
$c = $this->get_var('_gc', false);
267273
if (is_null($c)) {
268274
$c = 0;
269275
}
276+
277+
$islogmodeenabled = get_config('qtype_wq', 'log_server_errors') == '1';
278+
if ($islogmodeenabled) {
279+
$errormessage = 'WIRISQUIZZES ATTEMPT ERROR --- INCREASING ATTEMPT COUNT TO ' . ($c + 1) . ' FOR STEP WITH ID ' .
280+
($this->step != null ? $this->step->get_id() : $this->stepid) . PHP_EOL .
281+
'EXCEPTION: ' . $e->getMessage();
282+
// @codingStandardsIgnoreLine
283+
error_log($errormessage);
284+
}
285+
270286
$this->set_var('_gc', $c + 1, false);
271287
}
272288

version.php

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

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

19-
$plugin->version = 2024032204;
19+
$plugin->version = 2024032205;
2020
$plugin->requires = 2015111600; // Moodle 3.0.
21-
$plugin->release = '4.11.4';
21+
$plugin->release = '4.11.5';
2222
$plugin->maturity = MATURITY_STABLE;
2323
$plugin->component = 'qtype_wq';
2424
$plugin->dependencies = array(
25-
'filter_wiris' => ANY_VERSION
25+
'filter_wiris' => 2024100700
2626
);

0 commit comments

Comments
 (0)