Skip to content
Snippets Groups Projects
Commit f27bcbd3 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

prevent warnings in lt exercise

parent 768defef
No related branches found
No related tags found
1 merge request!9Resolve "PHP8-Warnungen"
...@@ -81,7 +81,8 @@ class lt_exercise extends Exercise ...@@ -81,7 +81,8 @@ class lt_exercise extends Exercise
if ($musterLoesung === $studentSolution) { if ($musterLoesung === $studentSolution) {
$similarity_temp = 1; $similarity_temp = 1;
} else if ($this->task['compare'] === 'levenshtein') { // Levenshtein-Distanz } else if (isset($this->task['compare'])) {
if ($this->task['compare'] === 'levenshtein') { // Levenshtein-Distanz
$string1 = mb_substr($studentSolution, 0, 255); $string1 = mb_substr($studentSolution, 0, 255);
$string2 = mb_substr($musterLoesung, 0, 255); $string2 = mb_substr($musterLoesung, 0, 255);
$divisor = max(mb_strlen($string1), mb_strlen($string2)); $divisor = max(mb_strlen($string1), mb_strlen($string2));
...@@ -114,6 +115,7 @@ class lt_exercise extends Exercise ...@@ -114,6 +115,7 @@ class lt_exercise extends Exercise
} }
} }
} }
}
if ($answer['score'] == 1) { // correct if ($answer['score'] == 1) { // correct
if ($similarity_temp > $similarity) { if ($similarity_temp > $similarity) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment