Code Duplication    Length = 11-13 lines in 2 locations

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

@@ 3900-3910 (lines=11) @@
3897
3898
                // Category report
3899
                $category_was_added_for_this_test = false;
3900
                if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) {
3901
                    if (!isset($category_list[$objQuestionTmp->category]['score'])) {
3902
                        $category_list[$objQuestionTmp->category]['score'] = 0;
3903
                    }
3904
                    if (!isset($category_list[$objQuestionTmp->category]['total'])) {
3905
                        $category_list[$objQuestionTmp->category]['total'] = 0;
3906
                    }
3907
                    $category_list[$objQuestionTmp->category]['score'] += $my_total_score;
3908
                    $category_list[$objQuestionTmp->category]['total'] += $my_total_weight;
3909
                    $category_was_added_for_this_test = true;
3910
                }
3911
3912
                if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) {
3913
                    foreach ($objQuestionTmp->category_list as $category_id) {

main/exercise/exercise_show.php 1 location

@@ 840-852 (lines=13) @@
837
    $totalWeighting += $questionWeighting;
838
    $category_was_added_for_this_test = false;
839
840
    if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) {
841
        if (!isset($category_list[$objQuestionTmp->category]['score'])) {
842
            $category_list[$objQuestionTmp->category]['score'] = 0;
843
        }
844
845
        if (!isset($category_list[$objQuestionTmp->category]['total'])) {
846
            $category_list[$objQuestionTmp->category]['total'] = 0;
847
        }
848
849
        $category_list[$objQuestionTmp->category]['score'] += $my_total_score;
850
        $category_list[$objQuestionTmp->category]['total'] += $my_total_weight;
851
        $category_was_added_for_this_test = true;
852
    }
853
854
    if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) {
855
        foreach ($objQuestionTmp->category_list as $category_id) {