Commit ea59f727 authored by Johannes Löthberg's avatar Johannes Löthberg Committed by Lukas Fleischer
Browse files

RPC: Add decimal_fields array for floating-point fields



Fixes FS#45537.

Signed-off-by: Johannes Löthberg's avatarJohannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent feeda37b
......@@ -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']));
}
......
Supports Markdown
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