Code Duplication    Length = 10-11 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3691-3701 (lines=11) @@
3688
                                }
3689
3690
                                $isAnswerCorrect = 0;
3691
                                if (FillBlanks::isGoodStudentAnswer($studentAnswer, $correctAnswer)) {
3692
                                    // gives the related weighting to the student
3693
                                    $questionScore += $answerWeighting[$i];
3694
                                    // increments total score
3695
                                    $totalScore += $answerWeighting[$i];
3696
                                    $isAnswerCorrect = 1;
3697
                                }
3698
                                $listCorrectAnswers['studentanswer'][$i] = $studentAnswer;
3699
                                $listCorrectAnswers['studentscore'][$i] = $isAnswerCorrect;
3700
                            }
3701
                        } else {
3702
                            // switchable answer
3703
                            $listStudentAnswerTemp = $choice;
3704
                            $listTeacherAnswerTemp = $listCorrectAnswers['tabwords'];
@@ 3712-3721 (lines=10) @@
3709
                                for ($j = 0; $j < count($listTeacherAnswerTemp); $j++) {
3710
                                    $correctAnswer = $listTeacherAnswerTemp[$j];
3711
                                    if (!$found) {
3712
                                        if (FillBlanks::isGoodStudentAnswer(
3713
                                            $studentAnswer,
3714
                                            $correctAnswer
3715
                                        )
3716
                                        ) {
3717
                                            $questionScore += $answerWeighting[$i];
3718
                                            $totalScore += $answerWeighting[$i];
3719
                                            $listTeacherAnswerTemp[$j] = '';
3720
                                            $found = true;
3721
                                        }
3722
                                    }
3723
                                }
3724
                                $listCorrectAnswers['studentanswer'][$i] = $studentAnswer;