Commit 2284cb3e authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

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's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 74c7cf70
......@@ -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,
......
......@@ -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:
......
......@@ -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"])): ?>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment