Code Duplication    Length = 4-5 lines in 3 locations

main/survey/survey.lib.php 1 location

@@ 2460-2463 (lines=4) @@
2457
                GROUP BY option_id, value";
2458
        $result = Database::query($sql);
2459
        $number_of_answers = 0;
2460
        while ($row = Database::fetch_array($result)) {
2461
            $number_of_answers += $row['total'];
2462
            $data[$row['option_id']][$row['value']] = $row;
2463
        }
2464
2465
        $chartData = array();
2466
        foreach ($options as $option) {

main/survey/fillsurvey.php 2 locations

@@ 761-765 (lines=5) @@
758
                    ";
759
760
            $result = Database::query($sql);
761
            while ($row = Database :: fetch_array($result)) {
762
                $answer_list['value'] = $row['value'];
763
                $answer_list['group'] = $row['survey_group_pri'];
764
                $results[] = $answer_list;
765
            }
766
767
            //echo '<br />'; print_r($results); echo '<br />';
768
            // Get the total score for each group of questions
@@ 792-796 (lines=5) @@
789
                    ORDER BY temp.survey_group_pri";
790
791
            $result = Database::query($sql);
792
            while ($row = Database::fetch_array($result)) {
793
                $list['value'] = $row['value'];
794
                $list['group'] = $row['survey_group_pri'];
795
                $totals[] = $list;
796
            }
797
            //echo '<pre>'; print_r($totals);
798
799
            $final_results = array();