mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Use `/usr/bin/env python3` instead of `/usr/bin/python3` in the shebang of Python scripts. This adds support for non-standard Python interpreter paths such as the paths used in virtualenv environments. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
26 lines
678 B
Python
Executable file
26 lines
678 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import time
|
|
|
|
import aurweb.db
|
|
|
|
|
|
def main():
|
|
conn = aurweb.db.Connection()
|
|
|
|
conn.execute("UPDATE PackageBases SET NumVotes = (" +
|
|
"SELECT COUNT(*) FROM PackageVotes " +
|
|
"WHERE PackageVotes.PackageBaseID = PackageBases.ID)")
|
|
|
|
now = int(time.time())
|
|
conn.execute("UPDATE PackageBases SET Popularity = (" +
|
|
"SELECT COALESCE(SUM(POWER(0.98, (? - VoteTS) / 86400)), 0.0) " +
|
|
"FROM PackageVotes WHERE PackageVotes.PackageBaseID = " +
|
|
"PackageBases.ID AND NOT VoteTS IS NULL)", [now])
|
|
|
|
conn.commit()
|
|
conn.close()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|