mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 09:43:03 +00:00
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>
This commit is contained in:
parent
6844f6c1d2
commit
9ff082be25
3 changed files with 16 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue