Code Duplication    Length = 10-11 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3677-3687 (lines=11) @@
3674
                                }
3675
3676
                                $isAnswerCorrect = 0;
3677
                                if (FillBlanks::isGoodStudentAnswer($studentAnswer, $correctAnswer)) {
3678
                                    // gives the related weighting to the student
3679
                                    $questionScore += $answerWeighting[$i];
3680
                                    // increments total score
3681
                                    $totalScore += $answerWeighting[$i];
3682
                                    $isAnswerCorrect = 1;
3683
                                }
3684
                                $listCorrectAnswers['studentanswer'][$i] = $studentAnswer;
3685
                                $listCorrectAnswers['studentscore'][$i] = $isAnswerCorrect;
3686
                            }
3687
                        } else {
3688
                            // switchable answer
3689
                            $listStudentAnswerTemp = $choice;
3690
                            $listTeacherAnswerTemp = $listCorrectAnswers['tabwords'];
@@ 3700-3709 (lines=10) @@
3697
                                for ($j = 0; $j < count($listTeacherAnswerTemp); $j++) {
3698
                                    $correctAnswer = $listTeacherAnswerTemp[$j];
3699
                                    if (!$found) {
3700
                                        if (FillBlanks::isGoodStudentAnswer(
3701
                                            $studentAnswer,
3702
                                            $correctAnswer
3703
                                        )
3704
                                        ) {
3705
                                            $questionScore += $answerWeighting[$i];
3706
                                            $totalScore += $answerWeighting[$i];
3707
                                            $listTeacherAnswerTemp[$j] = "";
3708
                                            $found = true;
3709
                                        }
3710
                                    }
3711
                                }
3712
                                $listCorrectAnswers['studentanswer'][$i] = $studentAnswer;