diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2015-06-15 12:29:24 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2015-06-15 22:37:45 +0200 |
commit | 2284cb3e4a2ef86b1a2a548ed0b4431ace978d87 (patch) | |
tree | 64fc20eea94200e6dde3c3feb4f62e5e043606da | |
parent | 74c7cf70ffe49d907df13521edd760467d0602b0 (diff) | |
download | aurweb-2284cb3e4a2ef86b1a2a548ed0b4431ace978d87.tar.xz |
Store 10 significant digits of the popularity score
Even if we only display two digits after the decimal point, storing more
digits internally allows us to order the search results more accurately.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rw-r--r-- | schema/aur-schema.sql | 2 | ||||
-rw-r--r-- | upgrading/4.0.0.txt | 2 | ||||
-rw-r--r-- | web/template/pkg_search_results.php | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql index 9ac5d44..5a702b2 100644 --- a/schema/aur-schema.sql +++ b/schema/aur-schema.sql @@ -70,7 +70,7 @@ CREATE TABLE PackageBases ( ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Name VARCHAR(255) NOT NULL, NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0, - Popularity DECIMAL(6,2) UNSIGNED NOT NULL DEFAULT 0, + Popularity DECIMAL(10,6) UNSIGNED NOT NULL DEFAULT 0, OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL, SubmittedTS BIGINT UNSIGNED NOT NULL, ModifiedTS BIGINT UNSIGNED NOT NULL, diff --git a/upgrading/4.0.0.txt b/upgrading/4.0.0.txt index fd04c44..954dfcc 100644 --- a/upgrading/4.0.0.txt +++ b/upgrading/4.0.0.txt @@ -35,7 +35,7 @@ CREATE TABLE PackageComaintainers ( ---- ALTER TABLE PackageBases - ADD COLUMN Popularity DECIMAL(6,2) UNSIGNED NOT NULL DEFAULT 0; + ADD COLUMN Popularity DECIMAL(10,6) UNSIGNED NOT NULL DEFAULT 0; ---- 6. Drop the category ID foreign key from the PackageBases table: diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index 5c8f73e..7134f2d 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -54,7 +54,7 @@ if (!$result): ?> <td><a href="<?= htmlspecialchars(get_pkg_uri($row["Name"]), ENT_QUOTES); ?>"><?= htmlspecialchars($row["Name"]) ?></a></td> <td<?php if ($row["OutOfDateTS"]): ?> class="flagged"<?php endif; ?>><?= htmlspecialchars($row["Version"]) ?></td> <td><?= $row["NumVotes"] ?></td> - <td><?= $row["Popularity"] ?></td> + <td><?= number_format($row["Popularity"], 2) ?></td> <?php if ($SID): ?> <td> <?php if (isset($row["Voted"])): ?> |