Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.

Commit 3ec4250

Browse files
RezaMohammadi99vmw
authored andcommitted
Fixed Parameter search rounding error.
This commit sets the default precision of part parameter searching to femto to maintain fractional values.
1 parent 8accb90 commit 3ec4250

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

src/PartKeepr/FrontendBundle/Resources/public/css/PartKeepr.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,4 @@ margin-left: -75px;
233233
border: 1px solid #b8daff;
234234
border-radius: .25rem;
235235
padding: .25rem .75rem;
236-
}
236+
}

src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,11 @@ Ext.define('PartKeepr.PartsGrid', {
408408
{
409409
if (siPrefix instanceof PartKeepr.SiPrefixBundle.Entity.SiPrefix) {
410410
var fractionValue = value * Math.pow(siPrefix.get("base"), siPrefix.get("exponent"));
411-
411+
412412
if (siPrefix.get("exponent") < 0)
413413
{
414-
return fractionValue.toFixed(Math.abs(siPrefix.get("exponent")));
414+
return fractionValue.toFixed(15); // set to femto by default
415+
//Math.abs(siPrefix.get("exponent")));
415416
} else
416417
{
417418
return fractionValue;

src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportGrid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Ext.define('PartKeepr.Components.Project.ProjectReportGrid', {
1919
autoSync: false,
2020
remoteFilter: true,
2121
remoteSort: true,
22-
pageSize: 10,
22+
pageSize: 5,
2323
model: "PartKeepr.ProjectBundle.Entity.Report",
2424
filters: [{
2525
property: "name",

src/PartKeepr/PartBundle/Entity/Part.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class Part extends BaseEntity
162162
*
163163
* @var float
164164
*/
165-
private $averagePrice = 0;
165+
private $averagePrice = 0;
166166

167167
/**
168168
* The stock level history.
@@ -759,7 +759,8 @@ public function getAveragePrice()
759759
*/
760760
public function setAveragePrice($price)
761761
{
762-
$this->averagePrice = $price;
762+
if($price != 0)
763+
$this->averagePrice = $price;
763764
}
764765

765766
/**
@@ -784,6 +785,10 @@ public function onPreUpdate()
784785
public function addStockLevel(StockEntry $stockEntry)
785786
{
786787
$stockEntry->setPart($this);
788+
789+
if($this->getAveragePrice() != 0)
790+
$stockEntry->setPrice($this->getAveragePrice());
791+
787792
$this->stockLevels->add($stockEntry);
788793
}
789794

src/PartKeepr/StockBundle/Entity/StockEntry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function getUser()
213213
public function checkPrice()
214214
{
215215
if ($this->getStockLevel() < 0 && $this->getPrice() !== null) {
216-
$this->setPrice(null);
216+
//$this->setPrice(null);
217217
}
218218
}
219219

0 commit comments

Comments
 (0)