Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-39488 Lesson Module: Improve code performance

  • Loading branch information...
commit b26066bf68ba9b396e1f4ff7d6f9a4b10409cb13 1 parent 9705bfa
@rwijaya rwijaya authored
Showing with 4 additions and 8 deletions.
  1. +4 −8 mod/lesson/pagetypes/matching.php
View
12 mod/lesson/pagetypes/matching.php
@@ -161,14 +161,6 @@ public function check_answer() {
}
$response = $data->response;
-
- foreach ($response as $resp) {
- if ($resp == '') {
- $result->noanswer = true;
- return $result;
- }
- }
-
$answers = $this->get_answers();
$correct = array_shift($answers);
@@ -184,6 +176,10 @@ public function check_answer() {
$hits = 0;
$userresponse = array();
foreach ($response as $id => $value) {
+ if ($value == '') {
+ $result->noanswer = true;
+ return $result;
+ }
$userresponse[] = $value;
// Make sure the user's answer exists in question's answer
if (array_key_exists($id, $answers)) {
Please sign in to comment.
Something went wrong with that request. Please try again.