diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2013-08-04 15:08:05 +0200 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2013-08-22 17:47:51 +0200 |
commit | 9ff082be25d444535ce99410363e63f6cca5f30d (patch) | |
tree | 8a0ba4c58dadad8ffe86888da7e6156739f098f5 /web/lib/acctfuncs.inc.php | |
parent | 6844f6c1d2965cd5ec2ad72c887baeed9517c246 (diff) | |
download | aurweb-9ff082be25d444535ce99410363e63f6cca5f30d.tar.xz |
Store the number of TUs when starting a vote
This will be used for automated calculation of vote participation later.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/acctfuncs.inc.php')
-rw-r--r-- | web/lib/acctfuncs.inc.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 7602ec2..738c7b2 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -618,10 +618,16 @@ function open_user_proposals($user) { function add_tu_proposal($agenda, $user, $votelength, $submitteruid) { $dbh = DB::connect(); - $q = "INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End, SubmitterID) VALUES "; + $q = "SELECT COUNT(*) FROM Users WHERE AccountTypeID = 2"; + $result = $dbh->query($q); + $row = $result->fetch(PDO::FETCH_NUM); + $active_tus = $row[0]; + + $q = "INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End, "; + $q.= "SubmitterID, ActiveTUs) VALUES "; $q.= "(" . $dbh->quote($agenda) . ", " . $dbh->quote($user) . ", "; $q.= "UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + " . $dbh->quote($votelength); - $q.= ", " . $submitteruid . ")"; + $q.= ", " . $submitteruid . ", " . $active_tus . ")"; $result = $dbh->exec($q); } |