Code Duplication    Length = 7-9 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3327-3333 (lines=7) @@
3324
                                    question_id = ".$questionId;
3325
3326
                        $result = Database::query($sql);
3327
                        while ($row = Database::fetch_array($result)) {
3328
                            $ind = $row['answer'];
3329
                            $values = explode(':', $ind);
3330
                            $my_answer_id = isset($values[0]) ? $values[0] : '';
3331
                            $option = isset($values[1]) ? $values[1] : '';
3332
                            $choice[$my_answer_id] = $option;
3333
                        }
3334
                    }
3335
3336
                    $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
@@ 3416-3424 (lines=9) @@
3413
                        $sql = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT."
3414
                                WHERE exe_id = $exeId AND question_id= ".$questionId;
3415
                        $resultans = Database::query($sql);
3416
                        while ($row = Database::fetch_array($resultans)) {
3417
                            $ind = $row['answer'];
3418
                            $result = explode(':',$ind);
3419
                            if (isset($result[0])) {
3420
                                $my_answer_id = isset($result[0]) ? $result[0] : '';
3421
                                $option = isset($result[1]) ? $result[1] : '';
3422
                                $choice[$my_answer_id] = $option;
3423
                            }
3424
                        }
3425
                        $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : '';
3426
3427
                        if ($answerCorrect == $studentChoice) {