mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2782 from SchrodingersGat/floating-point-fixes
Fix floating point issues
This commit is contained in:
commit
aed7a35312
@ -1025,9 +1025,10 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store the required quantity in the row data
|
// Store the required quantity in the row data
|
||||||
row.required = quantity;
|
// Prevent weird rounding issues
|
||||||
|
row.required = parseFloat(quantity.toFixed(15));
|
||||||
|
|
||||||
return quantity;
|
return row.required;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sumAllocations(row) {
|
function sumAllocations(row) {
|
||||||
@ -1043,9 +1044,9 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
|||||||
quantity += item.quantity;
|
quantity += item.quantity;
|
||||||
});
|
});
|
||||||
|
|
||||||
row.allocated = quantity;
|
row.allocated = parseFloat(quantity.toFixed(15));
|
||||||
|
|
||||||
return quantity;
|
return row.allocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupCallbacks() {
|
function setupCallbacks() {
|
||||||
@ -1642,6 +1643,9 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) {
|
|||||||
remaining = 0;
|
remaining = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the quantity sent to the form field is correctly formatted
|
||||||
|
remaining = parseFloat(remaining.toFixed(15));
|
||||||
|
|
||||||
// We only care about entries which are not yet fully allocated
|
// We only care about entries which are not yet fully allocated
|
||||||
if (remaining > 0) {
|
if (remaining > 0) {
|
||||||
table_entries += renderBomItemRow(bom_item, remaining);
|
table_entries += renderBomItemRow(bom_item, remaining);
|
||||||
|
Loading…
Reference in New Issue
Block a user