Function __global->cns_calculate_vote_voting_power

Definitions

sources/cns_polls_action2.php

  • Calculate how much voting power a particular vote has, and cache it.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: float

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$vote_id AUTO_LINK No No required parameter N/A N/A The ID of the vote
$recalculate boolean No No False N/A N/A Recalculate even if a cached voting power already exists
$row ?array No No Null N/A N/A The database row for the vote, if it was already queried elsewhere (null: query for it)

Returns

  • The voting power for the specified vote
  • Type: float
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Calculate how much voting power a particular vote has, and cache it.
 *
 * @param  AUTO_LINK $vote_id The ID of the vote
 * @param  boolean $recalculate Recalculate even if a cached voting power already exists
 * @param  ?array $row The database row for the vote, if it was already queried elsewhere (null: query for it)
 * @return float The voting power for the specified vote
 */

function cns_calculate_vote_voting_power(int $vote_id, bool $recalculate = false, ?array $row = null) : float