editor store: ignore dup materials
This commit is contained in:
@ -340,17 +340,17 @@ export const store = new Vuex.Store({
|
|||||||
for (let section of state.catalog.sections) {
|
for (let section of state.catalog.sections) {
|
||||||
let models = getters.sectionModels(section)
|
let models = getters.sectionModels(section)
|
||||||
let existingModel = models.find(m => m.model === material.model)
|
let existingModel = models.find(m => m.model === material.model)
|
||||||
console.log('section', section.id, 'existing model search', existingModel)
|
|
||||||
if (existingModel) {
|
if (existingModel) {
|
||||||
// prevent duplicates here, but also allow adding the same
|
// console.log('section', section.id, 'found existing model', existingModel)
|
||||||
|
// NOTE prevent duplicates here, but also allow adding the same
|
||||||
// id again to a catalog. put in a new section so it can be
|
// id again to a catalog. put in a new section so it can be
|
||||||
// placed elsewhere?
|
// placed elsewhere? handle later.
|
||||||
let existingMaterial = existingModel.ids.find(m => m.id === material.id)
|
let existingMaterial = existingModel.ids.find(m => m === material.id)
|
||||||
console.log('model', existingModel.model, 'existing material', existingMaterial)
|
// console.log('model', existingModel.model, 'existing material', existingMaterial)
|
||||||
|
foundSection = section
|
||||||
|
foundModels = models
|
||||||
if (!existingMaterial) {
|
if (!existingMaterial) {
|
||||||
existingModel.ids.push(material.id)
|
existingModel.ids.push(material.id)
|
||||||
foundSection = section
|
|
||||||
foundModels = models
|
|
||||||
} else {
|
} else {
|
||||||
console.log('skip duplicate')
|
console.log('skip duplicate')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user