Add a time stamp to package base votes

This can potentially be used to identify trending packages.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-10-15 16:59:15 +02:00
parent c986ba0c52
commit e9ebcc4479
3 changed files with 10 additions and 3 deletions

View file

@ -667,12 +667,12 @@ function pkgbase_vote ($base_ids, $action=true) {
$first = 0;
$vote_ids = $pid;
if ($action) {
$vote_clauses = "($uid, $pid)";
$vote_clauses = "($uid, $pid, UNIX_TIMESTAMP())";
}
} else {
$vote_ids .= ", $pid";
if ($action) {
$vote_clauses .= ", ($uid, $pid)";
$vote_clauses .= ", ($uid, $pid, UNIX_TIMESTAMP())";
}
}
}
@ -686,7 +686,7 @@ function pkgbase_vote ($base_ids, $action=true) {
$dbh->exec($q);
if ($action) {
$q = "INSERT INTO PackageVotes (UsersID, PackageBaseID) VALUES ";
$q = "INSERT INTO PackageVotes (UsersID, PackageBaseID, VoteTS) VALUES ";
$q.= $vote_clauses;
} else {
$q = "DELETE FROM PackageVotes WHERE UsersID = $uid ";