Mercurial > hg > fapweb
changeset 79:b75f99a8973c
More work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 17 Oct 2013 18:44:16 +0300 |
parents | d50b64fbbc70 |
children | e51205f2bdd0 |
files | createdb.php results.inc.php vote.inc.php |
diffstat | 3 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/createdb.php Thu Oct 17 18:14:15 2013 +0300 +++ b/createdb.php Thu Oct 17 18:44:16 2013 +0300 @@ -164,8 +164,7 @@ "compos" => "id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(128), description VARCHAR(4096), visible INT DEFAULT 0, voting INT DEFAULT 0, showAuthors INT DEFAULT 0", "entries" => "id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(64), author VARCHAR(64), compo_id INT DEFAULT NULL, filename VARCHAR(256) DEFAULT NULL", - "attendees" => "id INTEGER PRIMARY KEY AUTOINCREMENT, regtime INT, name VARCHAR(64), groups VARCHAR(64), oneliner VARCHAR(64), email VARCHAR(80)", - "votekeys" => "id INTEGER PRIMARY KEY AUTOINCREMENT, attendee_id INT, key VARCHAR(64), active INT DEFAULT 0", + "attendees" => "id INTEGER PRIMARY KEY AUTOINCREMENT, regtime INT, name VARCHAR(64), groups VARCHAR(64), oneliner VARCHAR(64), email VARCHAR(80), votekey VARCHAR(64), active INT DEFAULT 0", "votes" => "id INTEGER PRIMARY KEY AUTOINCREMENT, entry_id INT DEFAULT NULL, voter_id INT DEFAULT NULL, value INT DEFAULT 0", );
--- a/results.inc.php Thu Oct 17 18:14:15 2013 +0300 +++ b/results.inc.php Thu Oct 17 18:44:16 2013 +0300 @@ -40,8 +40,10 @@ { $sql = "SELECT entries.*,SUM(votes.value) AS votesum ". - "FROM entries LEFT JOIN votes ON entries.id=votes.entry_id ". - "WHERE entries.compo_id=".$compo["id"]." ". + "FROM entries ". + "LEFT JOIN votes ON entries.id=votes.entry_id ". + "LEFT JOIN attendees ON attendees.id=votes.voter_id ". + "WHERE entries.compo_id=".$compo["id"]." AND attendees.active<>0 ". "GROUP BY votes.entry_id ". "ORDER BY votesum DESC";
--- a/vote.inc.php Thu Oct 17 18:14:15 2013 +0300 +++ b/vote.inc.php Thu Oct 17 18:44:16 2013 +0300 @@ -41,7 +41,7 @@ // Try fetching previously stored votes $sql = stPrepareSQL( "SELECT * FROM votes WHERE voter_id=%d", - stGetSessionItem("user_id")); + stGetSessionItem("voter_id")); if (($res = stExecSQL($sql)) !== false) {