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) {
|
||||
let models = getters.sectionModels(section)
|
||||
let existingModel = models.find(m => m.model === material.model)
|
||||
console.log('section', section.id, 'existing model search', 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
|
||||
// placed elsewhere?
|
||||
let existingMaterial = existingModel.ids.find(m => m.id === material.id)
|
||||
console.log('model', existingModel.model, 'existing material', existingMaterial)
|
||||
// placed elsewhere? handle later.
|
||||
let existingMaterial = existingModel.ids.find(m => m === material.id)
|
||||
// console.log('model', existingModel.model, 'existing material', existingMaterial)
|
||||
foundSection = section
|
||||
foundModels = models
|
||||
if (!existingMaterial) {
|
||||
existingModel.ids.push(material.id)
|
||||
foundSection = section
|
||||
foundModels = models
|
||||
} else {
|
||||
console.log('skip duplicate')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user