Skip to content

Commit

Permalink
fix inf checks
Browse files Browse the repository at this point in the history
  • Loading branch information
eynimeni committed Jan 11, 2024
1 parent dbfa4cc commit 22fb936
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions classes/teststrategy/preselect_task/addscalestandarderror.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,17 @@ protected function getplayedquestionsperscale(): array {
* @return array
*/
protected function getnumberofremainingquestionsperscale(): array {
$maxattemptsperscale = $this->context['max_attempts_per_scale'] === -1
? INF
: $this->context['max_attempts_per_scale'];
$pq = $this->getplayedquestionsperscale();
$catscales = $this->get_with_child_scales($this->context['catscaleid']);
foreach ($catscales as $scaleid) {
if (!array_key_exists($scaleid, $pq)) {
$remainingperscale[$scaleid] = $this->context['max_attempts_per_scale'];
$remainingperscale[$scaleid] = $maxattemptsperscale;
continue;
}
$remainingperscale[$scaleid] = $this->context['max_attempts_per_scale'] - count($pq[$scaleid]);
$remainingperscale[$scaleid] = $maxattemptsperscale - count($pq[$scaleid]);
}
return $remainingperscale;
}
Expand Down
2 changes: 1 addition & 1 deletion classes/teststrategy/preselect_task/mayberemovescale.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function run(array &$context, callable $next): result {
);
}

if ($context['max_attempts_per_scale'] == 0) {
if ($context['max_attempts_per_scale'] == -1) {
return $next($context);
}

Expand Down

0 comments on commit 22fb936

Please sign in to comment.