/[drupal]/contributions/modules/advpoll/modes/ranking.inc
ViewVC logotype

Diff of /contributions/modules/advpoll/modes/ranking.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.8.2.37.2.3, Thu Jan 1 00:20:41 2009 UTC revision 1.8.2.37.2.4, Thu Jan 1 01:28:12 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: ranking.inc,v 1.8.2.37.2.2 2008/12/08 04:19:20 chriskennedy Exp $  // $Id: ranking.inc,v 1.8.2.37.2.3 2009/01/01 00:20:41 chriskennedy Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 186  function advpoll_view_results_ranking($n Line 186  function advpoll_view_results_ranking($n
186        $ranking[$i]->choices = array();        $ranking[$i]->choices = array();
187        foreach ($choice_list as $choice_i) {        foreach ($choice_list as $choice_i) {
188          $ranking[$i]->choices[] = $choice_i;          $ranking[$i]->choices[] = $choice_i;
189          $ranking[$i]->view_score = $choices[$choice_i]['view_score'];          if (isset($choices[$choice_i]['view_score'])) {
190          $ranking[$i]->raw_score = $choices[$choice_i]['raw_score'];            $ranking[$i]->view_score = $choices[$choice_i]['view_score'];
191          if ($choices[$choice_i]['percentage']) {          }
192            if (isset($choices[$choice_i]['raw_score'])) {
193              $ranking[$i]->raw_score = $choices[$choice_i]['raw_score'];
194            }
195            if (isset($choices[$choice_i]['percentage'])) {
196            $ranking[$i]->percentage = $choices[$choice_i]['percentage'];            $ranking[$i]->percentage = $choices[$choice_i]['percentage'];
197          }          }
198        }        }
# Line 228  function advpoll_view_results_ranking($n Line 232  function advpoll_view_results_ranking($n
232          }          }
233    
234          // Show the ranking's score if it exists (depends on algorithm).          // Show the ranking's score if it exists (depends on algorithm).
235          if ($ranking[$i]->view_score) {          if (isset($ranking[$i]->view_score)) {
236            $output .= ' ('. $ranking[$i]->view_score .'%)';            $output .= ' ('. $ranking[$i]->view_score .'%)';
237          }          }
238          $output .= '</li>';          $output .= '</li>';
# Line 292  function advpoll_calculate_results_ranki Line 296  function advpoll_calculate_results_ranki
296    for ($i = 0; $i < count($results->ranking); $i++) {    for ($i = 0; $i < count($results->ranking); $i++) {
297      foreach ($results->ranking[$i]['choices'] as $choice) {      foreach ($results->ranking[$i]['choices'] as $choice) {
298        $cache[$choice][0]['ranking'] = $i;        $cache[$choice][0]['ranking'] = $i;
299        $cache[$choice][0]['raw_score'] = $results->ranking[$i]['raw_score'];        if (isset($results->ranking[$i]['raw_score'])) {
300        $cache[$choice][0]['view_score'] = $results->ranking[$i]['view_score'];          $cache[$choice][0]['raw_score'] = $results->ranking[$i]['raw_score'];
301          }
302          if (isset($results->ranking[$i]['view_score'])) {
303            $cache[$choice][0]['view_score'] = $results->ranking[$i]['view_score'];
304          }
305        if (isset($results->ranking[$i]['percentage'])) {        if (isset($results->ranking[$i]['percentage'])) {
306          $cache[$choice][0]['percentage'] = $results->ranking[$i]['percentage'];          $cache[$choice][0]['percentage'] = $results->ranking[$i]['percentage'];
307        }        }

Legend:
Removed from v.1.8.2.37.2.3  
changed lines
  Added in v.1.8.2.37.2.4

  ViewVC Help
Powered by ViewVC 1.1.2