Code Duplication    Length = 7-9 lines in 2 locations

main/exercice/exercise.class.php 2 locations

@@ 3348-3354 (lines=7) @@
3345
                                    question_id = ".$questionId;
3346
3347
                        $result = Database::query($sql);
3348
                        while ($row = Database::fetch_array($result)) {
3349
                            $ind = $row['answer'];
3350
                            $values = explode(':', $ind);
3351
                            $my_answer_id = isset($values[0]) ? $values[0] : '';
3352
                            $option = isset($values[1]) ? $values[1] : '';
3353
                            $choice[$my_answer_id] = $option;
3354
                        }
3355
                    }
3356
3357
                    $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
@@ 3437-3445 (lines=9) @@
3434
                        $sql = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT."
3435
                                WHERE exe_id = $exeId AND question_id= ".$questionId;
3436
                        $resultans = Database::query($sql);
3437
                        while ($row = Database::fetch_array($resultans)) {
3438
                            $ind = $row['answer'];
3439
                            $result = explode(':',$ind);
3440
                            if (isset($result[0])) {
3441
                                $my_answer_id = isset($result[0]) ? $result[0] : '';
3442
                                $option = isset($result[1]) ? $result[1] : '';
3443
                                $choice[$my_answer_id] = $option;
3444
                            }
3445
                        }
3446
                        $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : '';
3447
3448
                        if ($answerCorrect == $studentChoice) {