You are here

function advpoll_ranking_process_results in Advanced Poll 7.3

Same name and namespace in other branches
  1. 7 advpoll_ranking/advpoll_ranking.module \advpoll_ranking_process_results()
  2. 7.2 advpoll_ranking/advpoll_ranking.module \advpoll_ranking_process_results()
2 calls to advpoll_ranking_process_results()
advpoll_draggable_submit in advpoll_ranking/advpoll_ranking.module
Submit handler for ranking polls.
advpoll_ranking_submit in advpoll_ranking/advpoll_ranking.module
Submit handler for ranking polls.

File

advpoll_ranking/advpoll_ranking.module, line 527

Code

function advpoll_ranking_process_results($results, $choices, $votes) {
  foreach ($results as $key => $result) {
    if ($result) {

      // Make sure each vote has a unique rank.
      while (advpoll_ranking_vote_has_rank($votes, $result)) {
        ++$result;
      }
      $votes[] = array(
        'rank' => $result,
        'id' => $choices[$key]['choice_id'],
      );
    }
  }
  return $votes;
}