Skip to content

Commit

Permalink
Fixed bug with handling float entries with value 0 (#1369)
Browse files Browse the repository at this point in the history
* Fixed bug with handling float entries with value 0

* Updated web dependencies
  • Loading branch information
norberttech authored Jan 14, 2025
1 parent ac75fbe commit 57bdf56
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 194 deletions.
2 changes: 1 addition & 1 deletion src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(private readonly string $name, ?float $value, public
throw InvalidArgumentException::because('Precision must be greater or equal to 0 and less than 15');
}

$this->value = $value ? round($value, $this->precision) : null;
$this->value = $value !== null ? round($value, $this->precision) : null;
$this->type = type_float($this->value === null, $this->precision);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static function is_equal_data_provider() : \Generator
yield 'different names characters and different values with high precision' => [false, float_entry('NAME', 1.205502), float_entry('name', 1.205501)];
}

public function test_accessing_precission() : void
public function test_accessing_precision() : void
{
self::assertSame(6, float_entry('name', 1.0)->precision);
self::assertSame(3, float_entry('name', 1.0, 3)->precision);
Expand All @@ -30,6 +30,7 @@ public function test_accessing_precission() : void
public function test_entry_name_can_be_zero() : void
{
self::assertSame('0', (float_entry('0', 0))->name());
self::assertSame(0.0, (float_entry('0', 0))->value());
}

#[DataProvider('is_equal_data_provider')]
Expand Down
2 changes: 2 additions & 0 deletions web/landing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Flow PHP ETL - Web",
"type": "project",
"require": {
"php": "8.2.*",
"flow-php/etl": "1.x-dev",
"flow-php/etl-adapter-http": "1.x-dev",
"nyholm/psr7": "^1.8",
Expand All @@ -12,6 +13,7 @@
"symfony/http-foundation": "^6.4",
"symfony/routing": "^6.4",
"symfony/framework-bundle": "^6.4",
"symfony/config": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/asset-mapper": "^6.4",
"symfony/asset": "^6.4",
Expand Down
Loading

0 comments on commit 57bdf56

Please sign in to comment.