add news item about preliminary results of referendum ditto don't select
2005-11-07 Vincent Untz <vuntz@gnome.org> * foundation.gnome.org/index.wml: add news item about preliminary results of referendum * foundation.gnome.org/news/index.wml: ditto * foundation.gnome.org/vote/include/election-sql.php: (elec_get_results_election): don't select choice with id = -1 (it's a blank vote for referenda and we don't need to have it there to know it exists) (elec_get_votes_for_anon_token): ditto * foundation.gnome.org/vote/include/step4-commit.php: (step4_do): no need to insert the -1 vote for referenda. Add FIXME
This commit is contained in:
parent
a7f6717269
commit
d1ba4ff8fd
5 changed files with 55 additions and 16 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2005-11-07 Vincent Untz <vuntz@gnome.org>
|
||||
|
||||
* foundation.gnome.org/index.wml: add news item about preliminary
|
||||
results of referendum
|
||||
* foundation.gnome.org/news/index.wml: ditto
|
||||
* foundation.gnome.org/vote/include/election-sql.php:
|
||||
(elec_get_results_election): don't select choice with id = -1 (it's a
|
||||
blank vote for referenda and we don't need to have it there to know it
|
||||
exists)
|
||||
(elec_get_votes_for_anon_token): ditto
|
||||
* foundation.gnome.org/vote/include/step4-commit.php: (step4_do): no
|
||||
need to insert the -1 vote for referenda.
|
||||
Add FIXME
|
||||
|
||||
2005-11-05 Vincent Untz <vuntz@gnome.org>
|
||||
|
||||
* foundation.gnome.org/elections/2005/index.wml: add link to the iCal
|
||||
|
|
|
@ -39,6 +39,17 @@
|
|||
|
||||
<h2>News</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Preliminary results of the Reducing Board Size Referendum</strong>
|
||||
<small>(07/11/2005)</small>
|
||||
<blockquote>
|
||||
The preliminary results of the reducing board size referendum have
|
||||
been <a href="vote/results.php?election_id=1">posted</a>.
|
||||
You can <a href="vote/votes.php?election_id=1">verify the
|
||||
results</a> yourself.
|
||||
Any challenges to these results must be received by November 13th.
|
||||
</blockquote>
|
||||
</li>
|
||||
<li>
|
||||
<strong>2005 GNOME Foundation Elections</strong>
|
||||
<small>(04/11/2005)</small>
|
||||
|
@ -73,17 +84,6 @@
|
|||
Owen Taylor, Daniel Veillard, Luis Villa.
|
||||
</blockquote>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Preliminary results of 2004 elections announced</strong>
|
||||
<small>(08/12/2004)</small>
|
||||
<blockquote>
|
||||
The preliminary results of the elections have been <a
|
||||
href="elections/2004/preliminary-results.html">posted</a>.
|
||||
You can <a href="elections/2004/verify.html">verify the results</a>
|
||||
yourself.
|
||||
Any challenges to these results must be received by December 20th.
|
||||
</blockquote>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>More news is available <a href="news/">here</a>.</p>
|
||||
|
|
|
@ -11,6 +11,17 @@
|
|||
<h1>GNOME Foundation News</h1>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Preliminary results of the Reducing Board Size Referendum</strong>
|
||||
<small>(07/11/2005)</small>
|
||||
<blockquote>
|
||||
The preliminary results of the reducing board size referendum have
|
||||
been <a href="../vote/results.php?election_id=1">posted</a>.
|
||||
You can <a href="../vote/votes.php?election_id=1">verify the
|
||||
results</a> yourself.
|
||||
Any challenges to these results must be received by November 13th.
|
||||
</blockquote>
|
||||
</li>
|
||||
<li>
|
||||
<strong>2005 GNOME Foundation Elections</strong>
|
||||
<small>(04/11/2005)</small>
|
||||
|
|
|
@ -358,6 +358,11 @@ function elec_get_results_election ($handle, $election_id) {
|
|||
$query = "SELECT choice_id, COUNT(choice_id) AS total_choice 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";
|
||||
/* -1 is not a valid value: it's the default value for referenda.
|
||||
* It's a blank vote. There was a bug that let this choice be saved in the
|
||||
* votes, but we don't need it there since we already have the anonymous
|
||||
* token as a proof of the blank vote. */
|
||||
$query .= " AND vt.choice_id != '-1'";
|
||||
$query .= " GROUP BY choice_id";
|
||||
$query .= " ORDER BY total_choice DESC";
|
||||
|
||||
|
@ -386,6 +391,11 @@ function elec_get_votes_for_anon_token ($handle, $anon_token_id) {
|
|||
|
||||
$query = "SELECT choice_id FROM " . $votes_table;
|
||||
$query .= " WHERE anon_id = '".$escaped_anon_token_id."'";
|
||||
/* -1 is not a valid value: it's the default value for referenda.
|
||||
* It's a blank vote. There was a bug that let this choice be saved in the
|
||||
* votes, but we don't need it there since we already have the anonymous
|
||||
* token as a proof of the blank vote. */
|
||||
$query .= " AND choice_id != '-1'";
|
||||
$query .= " ORDER BY choice_id";
|
||||
|
||||
$result = mysql_query ($query, $handle);
|
||||
|
|
|
@ -66,17 +66,21 @@ function step4_do () {
|
|||
|
||||
if ($choices_nb == 1) {
|
||||
|
||||
$res = elec_insert_new_vote ($handle, $anon_token_id, $vote);
|
||||
if ($vote != -1) {
|
||||
//FIXME verify that $vote is valid for this election/referendum
|
||||
$res = elec_insert_new_vote ($handle, $anon_token_id, $vote);
|
||||
|
||||
if (!$res) {
|
||||
$error .= "Can not insert a vote: ".mysql_error ($handle)."<br />\n";
|
||||
elec_sql_rollback ($handle);
|
||||
return $result;
|
||||
if (!$res) {
|
||||
$error .= "Can not insert a vote: ".mysql_error ($handle)."<br />\n";
|
||||
elec_sql_rollback ($handle);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
foreach ($votes_array as $vote) {
|
||||
//FIXME verify that $vote is valid for this election/referendum
|
||||
$res = elec_insert_new_vote ($handle, $anon_token_id, $vote);
|
||||
|
||||
if (!$res) {
|
||||
|
|
Loading…
Reference in a new issue