9 conn
= aurweb
.db
.Connection()
11 conn
.execute("UPDATE PackageBases SET NumVotes = (" +
12 "SELECT COUNT(*) FROM PackageVotes " +
13 "WHERE PackageVotes.PackageBaseID = PackageBases.ID)")
15 now
= int(time
.time())
16 conn
.execute("UPDATE PackageBases SET Popularity = (" +
17 "SELECT COALESCE(SUM(POWER(0.98, (? - VoteTS) / 86400)), 0.0) " +
18 "FROM PackageVotes WHERE PackageVotes.PackageBaseID = " +
19 "PackageBases.ID AND NOT VoteTS IS NULL)", [now
])
25 if __name__
== '__main__':