Code Duplication    Length = 7-9 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3322-3328 (lines=7) @@
3319
                                    question_id = ".$questionId;
3320
3321
                        $result = Database::query($sql);
3322
                        while ($row = Database::fetch_array($result)) {
3323
                            $ind = $row['answer'];
3324
                            $values = explode(':', $ind);
3325
                            $my_answer_id = isset($values[0]) ? $values[0] : '';
3326
                            $option = isset($values[1]) ? $values[1] : '';
3327
                            $choice[$my_answer_id] = $option;
3328
                        }
3329
                    }
3330
3331
                    $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
@@ 3411-3419 (lines=9) @@
3408
                        $sql = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT."
3409
                                WHERE exe_id = $exeId AND question_id= ".$questionId;
3410
                        $resultans = Database::query($sql);
3411
                        while ($row = Database::fetch_array($resultans)) {
3412
                            $ind = $row['answer'];
3413
                            $result = explode(':',$ind);
3414
                            if (isset($result[0])) {
3415
                                $my_answer_id = isset($result[0]) ? $result[0] : '';
3416
                                $option = isset($result[1]) ? $result[1] : '';
3417
                                $choice[$my_answer_id] = $option;
3418
                            }
3419
                        }
3420
                        $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : '';
3421
3422
                        if ($answerCorrect == $studentChoice) {