Merge remote-tracking branch 'origin/dev-storageunit-refactor' into main-demo
This commit is contained in:
@@ -80,7 +80,13 @@ export const createMaterialStore = () => {
|
||||
addMaterial: (material) => {
|
||||
let updatedMaterial: MaterialSchema | undefined;
|
||||
set((state) => {
|
||||
const existingIndex = state.materials.findIndex(m => m.materialId === material.materialId);
|
||||
if (existingIndex !== -1) {
|
||||
state.materials.splice(existingIndex, 1);
|
||||
}
|
||||
|
||||
state.materials.push(material);
|
||||
updatedMaterial = JSON.parse(JSON.stringify(material));
|
||||
});
|
||||
return updatedMaterial;
|
||||
},
|
||||
|
||||
@@ -205,7 +205,7 @@ export const createStorageUnitStore = () => {
|
||||
|
||||
getFullStorageUnits: () => {
|
||||
return get().storageUnits.filter(
|
||||
s => s.currentLoad >= s.point.action.storageCapacity
|
||||
s => s.currentLoad >= s.storageCapacity
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user