Code Duplication    Length = 7-9 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3290-3296 (lines=7) @@
3287
                                    question_id = ".$questionId;
3288
3289
                        $result = Database::query($sql);
3290
                        while ($row = Database::fetch_array($result)) {
3291
                            $ind = $row['answer'];
3292
                            $values = explode(':', $ind);
3293
                            $my_answer_id = isset($values[0]) ? $values[0] : '';
3294
                            $option = isset($values[1]) ? $values[1] : '';
3295
                            $choice[$my_answer_id] = $option;
3296
                        }
3297
                    }
3298
3299
                    $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
@@ 3379-3387 (lines=9) @@
3376
                        $sql = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT."
3377
                                WHERE exe_id = $exeId AND question_id= ".$questionId;
3378
                        $resultans = Database::query($sql);
3379
                        while ($row = Database::fetch_array($resultans)) {
3380
                            $ind = $row['answer'];
3381
                            $result = explode(':',$ind);
3382
                            if (isset($result[0])) {
3383
                                $my_answer_id = isset($result[0]) ? $result[0] : '';
3384
                                $option = isset($result[1]) ? $result[1] : '';
3385
                                $choice[$my_answer_id] = $option;
3386
                            }
3387
                        }
3388
                        $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : '';
3389
3390
                        if ($answerCorrect == $studentChoice) {