Code Duplication    Length = 11-13 lines in 2 locations

main/inc/lib/exercise.lib.php 1 location

@@ 3821-3831 (lines=11) @@
3818
                // Category report
3819
                $category_was_added_for_this_test = false;
3820
3821
                if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) {
3822
                    if (!isset($category_list[$objQuestionTmp->category]['score'])) {
3823
                        $category_list[$objQuestionTmp->category]['score'] = 0;
3824
                    }
3825
                    if (!isset($category_list[$objQuestionTmp->category]['total'])) {
3826
                        $category_list[$objQuestionTmp->category]['total'] = 0;
3827
                    }
3828
                    $category_list[$objQuestionTmp->category]['score'] += $my_total_score;
3829
                    $category_list[$objQuestionTmp->category]['total'] += $my_total_weight;
3830
                    $category_was_added_for_this_test = true;
3831
                }
3832
3833
                if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) {
3834
                    foreach ($objQuestionTmp->category_list as $category_id) {

main/exercise/exercise_show.php 1 location

@@ 782-794 (lines=13) @@
779
    $totalWeighting += $questionWeighting;
780
    $category_was_added_for_this_test = false;
781
782
    if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) {
783
        if (!isset($category_list[$objQuestionTmp->category]['score'])) {
784
            $category_list[$objQuestionTmp->category]['score'] = 0;
785
        }
786
787
        if (!isset($category_list[$objQuestionTmp->category]['total'])) {
788
            $category_list[$objQuestionTmp->category]['total'] = 0;
789
        }
790
791
        $category_list[$objQuestionTmp->category]['score'] += $my_total_score;
792
        $category_list[$objQuestionTmp->category]['total'] += $my_total_weight;
793
        $category_was_added_for_this_test = true;
794
    }
795
796
    if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) {
797
        foreach ($objQuestionTmp->category_list as $category_id) {