private function fetchResponses() {
		if ($this->responses_by_choice) {
			return;
		}

		// Make sure choices without responses are included in the result
		foreach ($this->getChoices() as $choice) {
			$this->responses_by_choice[$choice->text] = 0;
		}

		// Get responses
		$responses = new ElggBatch('elgg_get_annotations', array(
			'guid' => $this->guid,
			'annotation_name' => 'vote',
			'limit' => false,
		));

		$users = array();

		// Cache the amount of results for each choice
		foreach ($responses as $response) {
			$users[] = $response->owner_guid;

			$this->responses_by_choice[$response->value] += 1;
		}

		$this->voter_count = count(array_unique($users));

		// Cache the total amount of responses
		$this->response_count = array_sum($this->responses_by_choice);
	}
private function fetchResponses() {
		if ($this->responses_by_choice) {
			return;
		}

		// Make sure choices without responses are included in the result
		foreach ($this->getChoices() as $choice) {
			$this->responses_by_choice[$choice->text] = 0;
		}

		// Get responses
		$responses = new ElggBatch('elgg_get_annotations', array(
			'guid' => $this->guid,
			'annotation_name' => 'vote',
			'limit' => false,
		));

		$users = array();

		// Cache the amount of results for each choice
		foreach ($responses as $response) {
			$users[] = $response->owner_guid;

			$this->responses_by_choice[$response->value] += 1;
		}

		$this->voter_count = count(array_unique($users));

		// Cache the total amount of responses
		$this->response_count = array_sum($this->responses_by_choice);
	}
private function fetchResponses ( ) { if ( $ this -> responses_by_choice ) { return ; } // Make sure choices without responses are included in the result foreach ( $ this -> getChoices ( ) as $ choice ) { $ this -> responses_by_choice [ $ choice -> text ] = 0 ; } // Get responses $ responses = new ElggBatch ( 'elgg_get_annotations' , array ( 'guid' => $ this -> guid , 'annotation_name' => 'vote' , 'limit' => false , ) ) ; $ users = array ( ) ; // Cache the amount of results for each choice foreach ( $ responses as $ response ) { $ users [ ] = $ response -> owner_guid ; $ this -> responses_by_choice [ $ response -> value ] += 1 ; } $ this -> voter_count = count ( array_unique ( $ users ) ) ; // Cache the total amount of responses $ this -> response_count = array_sum ( $ this -> responses_by_choice ) ; }
Fetch and cache amount of responses for each choice

Caches the data in form:
array(
'choice 1' => 5,
'choice 2' => 13,
'choice 3' => 2,
)
Fetch and cache amount of responses for each choice