Simplified the logic joining components to formulas
This commit is contained in:
parent
cf04bfc799
commit
5802840da5
@ -55,12 +55,10 @@ export class AppStore {
|
|||||||
let temp = <any>Object.assign({id: row.payload.doc.id, ref: row.payload.doc.ref}, row.payload.doc.data());
|
let temp = <any>Object.assign({id: row.payload.doc.id, ref: row.payload.doc.ref}, row.payload.doc.data());
|
||||||
temp.created = temp.created.toDate();
|
temp.created = temp.created.toDate();
|
||||||
|
|
||||||
let newComponents = [];
|
temp.components = temp.components.map(row => {
|
||||||
temp.components.forEach((row: any) => {
|
let component = data[1].filter(c => c.id == row.component.id)[0];
|
||||||
let c = <Component>data[1].filter(c => c.id == row.component.id)[0];
|
return {component: component, quantity: row.quantity};
|
||||||
newComponents.push({component: c, quantity: row.quantity});
|
|
||||||
});
|
});
|
||||||
temp.components = newComponents;
|
|
||||||
|
|
||||||
return <Formula>temp;
|
return <Formula>temp;
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user