@fleetbase/fleetops-engine 0.4.10 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/composer.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/fleetops-api",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Fleet-Ops",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "repository": "https://github.com/fleetbase/fleetops",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/fleetops-engine",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "fleetbase": {
6
6
  "route": "fleet-ops"
@@ -17,9 +17,9 @@ namespace Fleetbase\FleetOps\Support;
17
17
  class DistanceMatrix
18
18
  {
19
19
  public ?float $distance;
20
- public ?int $time;
20
+ public ?float $time;
21
21
 
22
- public function __construct(?float $distance, ?int $time)
22
+ public function __construct(?float $distance, ?float $time)
23
23
  {
24
24
  $this->distance = $distance;
25
25
  $this->time = $time;
@@ -783,8 +783,8 @@ class Utils extends FleetbaseUtils
783
783
  ]
784
784
  )->json();
785
785
 
786
- $distance = data_get($response, 'rows.0.elements.0.distance.value');
787
- $time = data_get($response, 'rows.0.elements.0.duration.value');
786
+ $distance = (float) data_get($response, 'rows.0.elements.0.distance.value', 0);
787
+ $time = (float) data_get($response, 'rows.0.elements.0.duration.value', 0);
788
788
 
789
789
  $result = static::createObject(
790
790
  [
@@ -812,7 +812,7 @@ class Utils extends FleetbaseUtils
812
812
  $destination = static::getPointFromMixed($destination);
813
813
 
814
814
  $distance = Utils::vincentyGreatCircleDistance($origin, $destination);
815
- $time = round($distance / 100) * self::DRIVING_TIME_MULTIPLIER;
815
+ $time = (float) round($distance / 100) * self::DRIVING_TIME_MULTIPLIER;
816
816
 
817
817
  return new DistanceMatrix($distance, $time);
818
818
  }