add links to the results display the number of blank votes if not null new
2005-11-07 Vincent Untz <vuntz@gnome.org> * foundation.gnome.org/referenda/2005-10/index.wml: add links to the results * foundation.gnome.org/vote/results.wml: display the number of blank votes if not null * foundation.gnome.org/vote/include/election-sql.php: (elec_get_blank_votes_election): new
This commit is contained in:
		
							parent
							
								
									d1ba4ff8fd
								
							
						
					
					
						commit
						0ead7be6c7
					
				
					 4 changed files with 49 additions and 0 deletions
				
			
		|  | @ -1,3 +1,12 @@ | |||
| 2005-11-07  Vincent Untz  <vuntz@gnome.org> | ||||
| 
 | ||||
| 	* foundation.gnome.org/referenda/2005-10/index.wml: add links to the | ||||
| 	results | ||||
| 	* foundation.gnome.org/vote/results.wml: display the number of blank | ||||
| 	votes if not null | ||||
| 	* foundation.gnome.org/vote/include/election-sql.php: | ||||
| 	(elec_get_blank_votes_election): new | ||||
| 
 | ||||
| 2005-11-07  Vincent Untz  <vuntz@gnome.org> | ||||
| 
 | ||||
| 	* foundation.gnome.org/index.wml: add news item about preliminary | ||||
|  |  | |||
|  | @ -31,6 +31,12 @@ | |||
| 
 | ||||
|     <h2>Reducing Board Size Referendum Materials:</h2> | ||||
|     <ul> | ||||
|       <li> | ||||
|         <a href="../../vote/votes.php?election_id=1">Archive of all votes</a> | ||||
|       </li> | ||||
|       <li> | ||||
|         <a href="../../vote/results.php?election_id=1">Preliminary results</a> | ||||
|       </li> | ||||
|       <li> | ||||
|         <a href="voters.html">List of registered voters</a> | ||||
|       </li> | ||||
|  |  | |||
|  | @ -381,6 +381,28 @@ function elec_get_results_election ($handle, $election_id) { | |||
|   return $retval; | ||||
| } | ||||
| 
 | ||||
| function elec_get_blank_votes_election ($handle, $election_id) { | ||||
|   global $anon_tokens_table; | ||||
|   global $votes_table; | ||||
| 
 | ||||
|   if ($handle === FALSE) | ||||
|     return FALSE; | ||||
| 
 | ||||
|   $escaped_election_id = mysql_real_escape_string ($election_id, $handle); | ||||
| 
 | ||||
|   $query = "SELECT COUNT(att.id) AS total_blank FROM " . $anon_tokens_table . " AS att, " . $votes_table . " AS vt"; | ||||
|   $query .= " WHERE att.election_id = '".$escaped_election_id."'"; | ||||
|   $query .= " AND att.id != vt.anon_id"; | ||||
|   $query .= " OR (vt.choice_id != '-1' AND att.id = vt.anon_id)"; | ||||
| 
 | ||||
|   $result = mysql_query ($query, $handle); | ||||
| 
 | ||||
|   if (!$result) | ||||
|     return FALSE; | ||||
| 
 | ||||
|   return mysql_result ($result, 0, 0); | ||||
| } | ||||
| 
 | ||||
| function elec_get_votes_for_anon_token ($handle, $anon_token_id) { | ||||
|   global $votes_table; | ||||
| 
 | ||||
|  |  | |||
|  | @ -60,6 +60,14 @@ if ($display) { | |||
|   } | ||||
| } | ||||
| 
 | ||||
| if ($display) { | ||||
|   $blank_results = elec_get_blank_votes_election ($handle, $election_id); | ||||
|   if ($results === FALSE) { | ||||
|     $error .= "Can not get the blank votes for this ".elec_election_get_type ($election).".\n"; | ||||
|     $display = FALSE; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| if ($display) { | ||||
|   $choices = elec_choices_get ($handle, $election_id); | ||||
|   if ($choices === FALSE) { | ||||
|  | @ -96,6 +104,10 @@ if ($display) { | |||
|       $error .= "There was an unkown vote: ".$result["choice_id"]."<br />\n"; | ||||
|     } | ||||
|   } | ||||
|   if ($blank_results > 0) { | ||||
|     echo "<br />"; | ||||
|     echo "blank votes: <strong>".$blank_results."</strong><br />\n"; | ||||
|   } | ||||
|   echo "</div>\n"; | ||||
| 
 | ||||
|   echo "<p>The automatic result of this ".elec_election_get_type ($election)." is thus:</p>\n"; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Vincent Untz
						Vincent Untz