mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
This commit is contained in:
parent
feeda37bb7
commit
ea59f72778
1 changed files with 7 additions and 0 deletions
|
@ -45,6 +45,9 @@ class AurJSON {
|
||||||
'ID', 'PackageBaseID', 'NumVotes', 'OutOfDate',
|
'ID', 'PackageBaseID', 'NumVotes', 'OutOfDate',
|
||||||
'FirstSubmitted', 'LastModified'
|
'FirstSubmitted', 'LastModified'
|
||||||
);
|
);
|
||||||
|
private static $decimal_fields = array(
|
||||||
|
'Popularity'
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handles post data, and routes the request.
|
* Handles post data, and routes the request.
|
||||||
|
@ -255,6 +258,10 @@ class AurJSON {
|
||||||
$row[$field] = intval($row[$field]);
|
$row[$field] = intval($row[$field]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (self::$decimal_fields as $field) {
|
||||||
|
$row[$field] = floatval($row[$field]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->version >= 2 && ($type == 'info' || $type == 'multiinfo')) {
|
if ($this->version >= 2 && ($type == 'info' || $type == 'multiinfo')) {
|
||||||
$row = array_merge($row, $this->get_extended_fields($row['ID']));
|
$row = array_merge($row, $this->get_extended_fields($row['ID']));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue