mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add a vote type to the TU proposal form
There are only four valid reasons for starting a TU vote, so instead of letting the user choose a vote length, let her pick a reason and set vote length and quorum based on that selection. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
64bfa6e828
commit
d41e40d9d6
2 changed files with 38 additions and 15 deletions
|
@ -615,7 +615,7 @@ function open_user_proposals($user) {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function add_tu_proposal($agenda, $user, $votelength, $submitteruid) {
|
||||
function add_tu_proposal($agenda, $user, $votelength, $quorum, $submitteruid) {
|
||||
$dbh = DB::connect();
|
||||
|
||||
$q = "SELECT COUNT(*) FROM Users WHERE AccountTypeID = 2";
|
||||
|
@ -623,11 +623,12 @@ function add_tu_proposal($agenda, $user, $votelength, $submitteruid) {
|
|||
$row = $result->fetch(PDO::FETCH_NUM);
|
||||
$active_tus = $row[0];
|
||||
|
||||
$q = "INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End, ";
|
||||
$q = "INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End, Quorum, ";
|
||||
$q.= "SubmitterID, ActiveTUs) VALUES ";
|
||||
$q.= "(" . $dbh->quote($agenda) . ", " . $dbh->quote($user) . ", ";
|
||||
$q.= "UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + " . $dbh->quote($votelength);
|
||||
$q.= ", " . $submitteruid . ", " . $active_tus . ")";
|
||||
$q.= ", " . $dbh->quote($quorum) . ", " . $submitteruid . ", ";
|
||||
$q.= $active_tus . ")";
|
||||
$result = $dbh->exec($q);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue