Code Duplication    Length = 10-11 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3633-3643 (lines=11) @@
3630
                                }
3631
3632
                                $isAnswerCorrect = 0;
3633
                                if (FillBlanks::isGoodStudentAnswer($studentAnswer, $correctAnswer)) {
3634
                                    // gives the related weighting to the student
3635
                                    $questionScore += $answerWeighting[$i];
3636
                                    // increments total score
3637
                                    $totalScore += $answerWeighting[$i];
3638
                                    $isAnswerCorrect = 1;
3639
                                }
3640
                                $listCorrectAnswers['studentanswer'][$i] = $studentAnswer;
3641
                                $listCorrectAnswers['studentscore'][$i] = $isAnswerCorrect;
3642
                            }
3643
                        } else {
3644
                            // switchable answer
3645
                            $listStudentAnswerTemp = $choice;
3646
                            $listTeacherAnswerTemp = $listCorrectAnswers['tabwords'];
@@ 3654-3663 (lines=10) @@
3651
                                for ($j = 0; $j < count($listTeacherAnswerTemp); $j++) {
3652
                                    $correctAnswer = $listTeacherAnswerTemp[$j];
3653
                                    if (!$found) {
3654
                                        if (FillBlanks::isGoodStudentAnswer(
3655
                                            $studentAnswer,
3656
                                            $correctAnswer
3657
                                        )
3658
                                        ) {
3659
                                            $questionScore += $answerWeighting[$i];
3660
                                            $totalScore += $answerWeighting[$i];
3661
                                            $listTeacherAnswerTemp[$j] = '';
3662
                                            $found = true;
3663
                                        }
3664
                                    }
3665
                                }
3666
                                $listCorrectAnswers['studentanswer'][$i] = $studentAnswer;