On Mon, Aug 05, 2013 at 07:55:19PM -0400, canyonknight wrote:
On Mon, Aug 5, 2013 at 5:43 PM, Lukas Fleischer <archlinux@cryptocrack.de> wrote:
This allows for easily keeping track of TUs that become active during a voting period later.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- UPGRADING | 18 +++++++++++++----- support/schema/aur-schema.sql | 10 +++++++++- web/lib/acctfuncs.inc.php | 23 ++++++++++++++--------- 3 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/UPGRADING b/UPGRADING index a300a91..740078c 100644 --- a/UPGRADING +++ b/UPGRADING @@ -10,13 +10,21 @@ From 2.2.0 to 2.3.0 ALTER TABLE Users ADD COLUMN InactivityTS BIGINT NOT NULL DEFAULT 0; ----
-2. Add fields to store the number of active TUs and the quorum to the - "TU_VoteInfo" table: +2. Add a field to store the quorum to the "TU_VoteInfo" table:
---- -ALTER TABLE TU_VoteInfo - ADD COLUMN ActiveTUs tinyint(3) unsigned NOT NULL default '0', - ADD COLUMN Quorum decimal(2, 2) unsigned NOT NULL;
I see this patch is based against "[PATCH 2/3] Store the number of active TUs when starting a vote". Are you going to drop that patch since this patch looks to supersede it?
Hmmm, yes. Rebasing sounds like a good idea here...
[...]
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 9df1856..3f7b595 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php [...] @@ -1026,6 +1025,12 @@ function vote_details($voteid) { $result = $dbh->query($q); $row = $result->fetch(PDO::FETCH_ASSOC);
+ $q = "SELECT COUNT(*) FROM TU_VoteActive WHERE VoteID = "; + $q.= intval($voteid); + $result = $dbh->query($q); + $row_ = $result->fetch(PDO::FETCH_NUM); + $row['ActiveTUs'] = $row_[0];
To avoid dealing with the array like above, could we do this?:
$row['ActiveTUs'] = $result->fetchColumn();
Sounds like a good idea. I wonder why we use fetch() followed by accessing the fetched row's first column everywhere else?
+ return $row; }
-- 1.8.4.rc1.383.g13e9f3f