Code Duplication    Length = 11-13 lines in 2 locations

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

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

main/exercise/exercise_show.php 1 location

@@ 822-834 (lines=13) @@
819
    $totalWeighting += $questionWeighting;
820
    $category_was_added_for_this_test = false;
821
822
    if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) {
823
        if (!isset($category_list[$objQuestionTmp->category]['score'])) {
824
            $category_list[$objQuestionTmp->category]['score'] = 0;
825
        }
826
827
        if (!isset($category_list[$objQuestionTmp->category]['total'])) {
828
            $category_list[$objQuestionTmp->category]['total'] = 0;
829
        }
830
831
        $category_list[$objQuestionTmp->category]['score'] += $my_total_score;
832
        $category_list[$objQuestionTmp->category]['total'] += $my_total_weight;
833
        $category_was_added_for_this_test = true;
834
    }
835
836
    if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) {
837
        foreach ($objQuestionTmp->category_list as $category_id) {