From d1ba4ff8fd7b644e9a2f3a7645d3bc527ee5db07 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Mon, 7 Nov 2005 07:34:18 +0000 Subject: [PATCH] add news item about preliminary results of referendum ditto don't select 2005-11-07 Vincent Untz * 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 --- ChangeLog | 14 ++++++++++++ foundation.gnome.org/index.wml | 22 +++++++++---------- foundation.gnome.org/news/index.wml | 11 ++++++++++ .../vote/include/election-sql.php | 10 +++++++++ .../vote/include/step4-commit.php | 14 +++++++----- 5 files changed, 55 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29bf34e..ac713da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-11-07 Vincent Untz + + * 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 * foundation.gnome.org/elections/2005/index.wml: add link to the iCal diff --git a/foundation.gnome.org/index.wml b/foundation.gnome.org/index.wml index edb5d0a..272475d 100644 --- a/foundation.gnome.org/index.wml +++ b/foundation.gnome.org/index.wml @@ -39,6 +39,17 @@

News

    +
  • + Preliminary results of the Reducing Board Size Referendum + (07/11/2005) +
    + The preliminary results of the reducing board size referendum have + been posted. + You can verify the + results yourself. + Any challenges to these results must be received by November 13th. +
    +
  • 2005 GNOME Foundation Elections (04/11/2005) @@ -73,17 +84,6 @@ Owen Taylor, Daniel Veillard, Luis Villa.
  • -
  • - Preliminary results of 2004 elections announced - (08/12/2004) -
    - The preliminary results of the elections have been posted. - You can verify the results - yourself. - Any challenges to these results must be received by December 20th. -
    -

More news is available here.

diff --git a/foundation.gnome.org/news/index.wml b/foundation.gnome.org/news/index.wml index 11108a2..2ca18b4 100644 --- a/foundation.gnome.org/news/index.wml +++ b/foundation.gnome.org/news/index.wml @@ -11,6 +11,17 @@

GNOME Foundation News

    +
  • + Preliminary results of the Reducing Board Size Referendum + (07/11/2005) +
    + The preliminary results of the reducing board size referendum have + been posted. + You can verify the + results yourself. + Any challenges to these results must be received by November 13th. +
    +
  • 2005 GNOME Foundation Elections (04/11/2005) diff --git a/foundation.gnome.org/vote/include/election-sql.php b/foundation.gnome.org/vote/include/election-sql.php index 73d46c7..91451fa 100644 --- a/foundation.gnome.org/vote/include/election-sql.php +++ b/foundation.gnome.org/vote/include/election-sql.php @@ -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); diff --git a/foundation.gnome.org/vote/include/step4-commit.php b/foundation.gnome.org/vote/include/step4-commit.php index 4467756..f85bd9a 100644 --- a/foundation.gnome.org/vote/include/step4-commit.php +++ b/foundation.gnome.org/vote/include/step4-commit.php @@ -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)."
    \n"; - elec_sql_rollback ($handle); - return $result; + if (!$res) { + $error .= "Can not insert a vote: ".mysql_error ($handle)."
    \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) {