summaryrefslogtreecommitdiffstats
path: root/scripts/popupdate.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/popupdate.py')
-rwxr-xr-xscripts/popupdate.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/popupdate.py b/scripts/popupdate.py
index 489cd419..f4c99ca8 100755
--- a/scripts/popupdate.py
+++ b/scripts/popupdate.py
@@ -23,5 +23,10 @@ cur = db.cursor()
cur.execute("UPDATE PackageBases SET NumVotes = (SELECT COUNT(*) FROM " +
"PackageVotes WHERE PackageVotes.PackageBaseID = PackageBases.ID)")
+cur.execute("UPDATE PackageBases SET Popularity = (" +
+ "SELECT SUM(POWER(0.98, (UNIX_TIMESTAMP() - VoteTS) / 86400)) " +
+ "FROM PackageVotes WHERE PackageVotes.PackageBaseID = " +
+ "PackageBases.ID AND NOT VoteTS IS NULL)")
+
db.commit()
db.close()