summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-07-04 12:31:41 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-07-04 13:02:37 +0200
commitea59f7277849c9f37a166375293d57bdd97bb20b (patch)
tree1a4670f927ae4b5135acc1114ac846e08830a554 /web
parentfeeda37bb754a57c480fdd58d68701d7853928f6 (diff)
downloadaurweb-ea59f7277849c9f37a166375293d57bdd97bb20b.tar.xz
RPC: Add decimal_fields array for floating-point fields
Fixes FS#45537. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web')
-rw-r--r--web/lib/aurjson.class.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index 7b77da4..debffc4 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -45,6 +45,9 @@ class AurJSON {
'ID', 'PackageBaseID', 'NumVotes', 'OutOfDate',
'FirstSubmitted', 'LastModified'
);
+ private static $decimal_fields = array(
+ 'Popularity'
+ );
/*
* Handles post data, and routes the request.
@@ -255,6 +258,10 @@ class AurJSON {
$row[$field] = intval($row[$field]);
}
+ foreach (self::$decimal_fields as $field) {
+ $row[$field] = floatval($row[$field]);
+ }
+
if ($this->version >= 2 && ($type == 'info' || $type == 'multiinfo')) {
$row = array_merge($row, $this->get_extended_fields($row['ID']));
}