mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 16:38:32 +00:00
Merge pull request #3134 from appwrite/fix-database-float-casting
fix(database): casting of float values
This commit is contained in:
commit
666f5ea49c
3 changed files with 7 additions and 1 deletions
|
|
@ -181,7 +181,7 @@ if(!empty($user) || !empty($pass)) {
|
|||
*/
|
||||
Database::addFilter('casting',
|
||||
function($value) {
|
||||
return json_encode(['value' => $value]);
|
||||
return json_encode(['value' => $value], JSON_PRESERVE_ZERO_FRACTION);
|
||||
},
|
||||
function($value) {
|
||||
if (is_null($value)) {
|
||||
|
|
|
|||
|
|
@ -71,6 +71,11 @@ class DatabaseV1 extends Worker
|
|||
$dbForConsole = $this->getConsoleDB();
|
||||
$dbForProject = $this->getProjectDB($projectId);
|
||||
|
||||
/**
|
||||
* Fetch attribute from the database, since with Resque float values are loosing informations.
|
||||
*/
|
||||
$attribute = $dbForProject->getDocument('attributes', $attribute->getId());
|
||||
|
||||
$event = 'database.attributes.update';
|
||||
$collectionId = $collection->getId();
|
||||
$key = $attribute->getAttribute('key', '');
|
||||
|
|
|
|||
|
|
@ -1428,6 +1428,7 @@ trait DatabaseBase
|
|||
]), [
|
||||
'key' => 'probability',
|
||||
'required' => false,
|
||||
'default' => 0,
|
||||
'min' => 0,
|
||||
'max' => 1,
|
||||
]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue