mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
popupdate: Avoid NULL entries in the popularity field
The popularity field is declared as "NOT NULL" in the database schema. Fix the popularity update query such that it uses a popularity of 0.0 instead of NULL for packages with no votes. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
c23914fc1d
commit
4c15f02ecb
1 changed files with 1 additions and 1 deletions
|
@ -22,7 +22,7 @@ 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)) " +
|
||||
"SELECT COALESCE(SUM(POWER(0.98, (UNIX_TIMESTAMP() - VoteTS) / 86400)), 0.0) " +
|
||||
"FROM PackageVotes WHERE PackageVotes.PackageBaseID = " +
|
||||
"PackageBases.ID AND NOT VoteTS IS NULL)")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue