You are here

function advpoll_calculate_results_binary in Advanced Poll 6.2

Same name and namespace in other branches
  1. 5 modes/binary.inc \advpoll_calculate_results_binary()
  2. 6.3 modes/binary.inc \advpoll_calculate_results_binary()
  3. 6 modes/binary.inc \advpoll_calculate_results_binary()

File

modes/binary.inc, line 164
Handle binary (true/false) votes.

Code

function advpoll_calculate_results_binary(&$cache, $node) {
  $result = db_query('SELECT uid, vote_source FROM {votingapi_vote} WHERE content_type = "advpoll" AND content_id = %d AND value_type = "option" GROUP BY uid, vote_source, timestamp', $node->nid);
  $total_votes = 0;
  while ($vote = db_fetch_object($result)) {
    $total_votes++;
  }
  votingapi_add_results(array(
    array(
      'content_type' => 'advpoll',
      'content_id' => $node->nid,
      'value_type' => '',
      'tag' => '_advpoll',
      'function' => 'total_votes',
      'value' => $total_votes,
    ),
  ));
}