Commit 9ff082be authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Store the number of TUs when starting a vote



This will be used for automated calculation of vote participation later.

Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent 6844f6c1
......@@ -10,6 +10,13 @@ From 2.2.0 to 2.3.0
ALTER TABLE Users ADD COLUMN InactivityTS BIGINT NOT NULL DEFAULT 0;
----
2. Add a field to store the total number of TUs to the "TU_VoteInfo" table:
----
ALTER TABLE TU_VoteInfo
ADD COLUMN ActiveTUs tinyint(3) unsigned NOT NULL default '0';
----
From 2.1.0 to 2.2.0
-------------------
......
......@@ -202,6 +202,7 @@ CREATE TABLE IF NOT EXISTS TU_VoteInfo (
Yes tinyint(3) unsigned NOT NULL default '0',
No tinyint(3) unsigned NOT NULL default '0',
Abstain tinyint(3) unsigned NOT NULL default '0',
ActiveTUs tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (ID),
FOREIGN KEY (SubmitterID) REFERENCES Users(ID) ON DELETE CASCADE
) ENGINE = InnoDB;
......
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment