diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2016-09-21 09:05:56 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2016-09-29 22:07:24 +0200 |
commit | 91f649f5edaae42f616ad9fc2facb90f1d71f9b9 (patch) | |
tree | 7d0c504203a6e2e50e991e2f6dd68c0556f5388d /scripts/popupdate.py | |
parent | cd2d90612b63711f9d92bff686698b6c37b79b2b (diff) |
scripts: Do not use UNIX_TIMESTAMP
Avoid using UNIX_TIMESTAMP which is not part of the SQL standard.
See f2a6bd2 (git-interface: Do not use UNIX_TIMESTAMP, 2016-08-05) for
related changes.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'scripts/popupdate.py')
-rwxr-xr-x | scripts/popupdate.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/popupdate.py b/scripts/popupdate.py index f5e09d9..58cd018 100755 --- a/scripts/popupdate.py +++ b/scripts/popupdate.py @@ -1,5 +1,7 @@ #!/usr/bin/python3 +import time + import aurweb.db @@ -10,10 +12,11 @@ def main(): "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, (UNIX_TIMESTAMP() - VoteTS) / 86400)), 0.0) " + + "SELECT COALESCE(SUM(POWER(0.98, (? - VoteTS) / 86400)), 0.0) " + "FROM PackageVotes WHERE PackageVotes.PackageBaseID = " + - "PackageBases.ID AND NOT VoteTS IS NULL)") + "PackageBases.ID AND NOT VoteTS IS NULL)", [now]) conn.commit() conn.close() |