diff --git a/app/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js b/app/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js index 21df0bdb..c80f7fa3 100644 --- a/app/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js +++ b/app/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js @@ -49,10 +49,10 @@ export default function getSlotFillFilter({slot, libraryIds}){ }); } if (tagsOr.length){ - filter.$and.push({$or: tagsOr}); + filter.$or = tagsOr; } if (tagsNin.length){ - filter.$and.push({$nin: tagsNin}); + filter.$and.push({tags: {$nin: tagsNin}}); } if (!filter.$and.length){ delete filter.$and; diff --git a/app/imports/server/publications/library.js b/app/imports/server/publications/library.js index 808327ee..217f9b00 100644 --- a/app/imports/server/publications/library.js +++ b/app/imports/server/publications/library.js @@ -14,6 +14,8 @@ const LIBRARY_NODE_TREE_FIELDS = { order: 1, parent: 1, ancestors: 1, + tags: 1, + slotFillerCondition: 1, // SlotFillers slotQuantityFilled: 1, // Effect diff --git a/app/imports/server/publications/slotFillers.js b/app/imports/server/publications/slotFillers.js index ab6e781d..30dadc9f 100644 --- a/app/imports/server/publications/slotFillers.js +++ b/app/imports/server/publications/slotFillers.js @@ -6,12 +6,6 @@ import getSlotFillFilter from '/imports/api/creature/creatureProperties/methods/ import getCreatureLibraryIds from '/imports/api/library/getCreatureLibraryIds.js'; import { LIBRARY_NODE_TREE_FIELDS } from '/imports/server/publications/library.js'; -const FIELDS = { - ...LIBRARY_NODE_TREE_FIELDS, - slotFillerCondition: 1, - tags: 1, -} - Meteor.publish('slotFillers', function(slotId, searchTerm){ if (searchTerm) check(searchTerm, String); @@ -56,7 +50,7 @@ Meteor.publish('slotFillers', function(slotId, searchTerm){ // relevant documents have a higher score. fields: { _score: { $meta: 'textScore' }, - ...FIELDS, + ...LIBRARY_NODE_TREE_FIELDS, }, sort: { // `score` property specified in the projection fields above. @@ -72,7 +66,7 @@ Meteor.publish('slotFillers', function(slotId, searchTerm){ name: 1, order: 1, }, - fields: FIELDS, + fields: LIBRARY_NODE_TREE_FIELDS, }; } options.limit = limit; @@ -135,7 +129,7 @@ Meteor.publish('classFillers', function(classId){ name: 1, order: 1, }, - fields: FIELDS, + fields: LIBRARY_NODE_TREE_FIELDS, limit, }; diff --git a/app/imports/ui/creature/CreatureForm.vue b/app/imports/ui/creature/CreatureForm.vue index b9103ff8..ad35a5e1 100644 --- a/app/imports/ui/creature/CreatureForm.vue +++ b/app/imports/ui/creature/CreatureForm.vue @@ -91,6 +91,7 @@ { this.libraryWriteLoading = true; this.dirty = false; @@ -189,7 +194,6 @@ export default { this.libraryWriteError = error; }); }, 500); - }, meteor: { $subscribe: { @@ -232,10 +236,10 @@ export default { ); } }, - allUserLibrariesChange(val, ack) { + allUserLibrariesChange(value, ack) { toggleAllUserLibraries.call({ _id: this.model._id, - val + value, }, error => ack(error)); }, selectLibrary(id, val) { diff --git a/app/imports/ui/creature/buildTree/BuildTreeNode.vue b/app/imports/ui/creature/buildTree/BuildTreeNode.vue index 45d4d07d..5664453c 100644 --- a/app/imports/ui/creature/buildTree/BuildTreeNode.vue +++ b/app/imports/ui/creature/buildTree/BuildTreeNode.vue @@ -150,7 +150,8 @@ }, canFillWithMany(){ return this.isSlot && ( - this. node.quantityExpected?.value === 0 || + !this.node.quantityExpected || + this.node.quantityExpected.value === 0 || (this.node.quantityExpected.value > 1 && this.node.spaceLeft > 0) ); }, diff --git a/app/imports/ui/creature/character/characterSheetTabs/BuildTab.vue b/app/imports/ui/creature/character/characterSheetTabs/BuildTab.vue index 068b136d..96de600c 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/BuildTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/BuildTab.vue @@ -207,6 +207,7 @@ export default { $or: [ {'slotCondition.value': {$nin: [false, 0, '']}}, {'slotCondition.value': {$exists: false}}, + {'slotCondition': {$exists: false}}, ], removed: {$ne: true}, inactive: {$ne: true}, @@ -228,7 +229,8 @@ export default { const model = child.node; const isSlotWithSpace = model.type === 'propertySlot' && model.spaceLeft > 0 || - (model.quantityExpected && model.quantityExpected.value == 0); + !model.quantityExpected || + model.quantityExpected.value === 0; if(isSlotWithSpace) { model._canFill = true; parents.forEach(node => { diff --git a/app/imports/ui/creature/slots/SlotCardsToFill.vue b/app/imports/ui/creature/slots/SlotCardsToFill.vue index 0decfebf..b2137955 100644 --- a/app/imports/ui/creature/slots/SlotCardsToFill.vue +++ b/app/imports/ui/creature/slots/SlotCardsToFill.vue @@ -85,8 +85,8 @@ export default { ] },{ $or: [ - { quantityExpected: {exists: false} }, - { 'quantityExpected.value': 0 }, + { 'quantityExpected.value': {$in: [false, 0, '', undefined]} }, + { 'quantityExpected.value': {exists: false} }, {spaceLeft: {$gt: 0}}, ] }, diff --git a/app/imports/ui/creature/slots/SlotFillDialog.vue b/app/imports/ui/creature/slots/SlotFillDialog.vue index e8c19896..caee497e 100644 --- a/app/imports/ui/creature/slots/SlotFillDialog.vue +++ b/app/imports/ui/creature/slots/SlotFillDialog.vue @@ -29,13 +29,13 @@ {{ slotPropertyTypeName }} with tags: diff --git a/app/imports/ui/properties/forms/SlotForm.vue b/app/imports/ui/properties/forms/SlotForm.vue index 719d83ed..6c001c2c 100644 --- a/app/imports/ui/properties/forms/SlotForm.vue +++ b/app/imports/ui/properties/forms/SlotForm.vue @@ -72,11 +72,14 @@ @change="change('slotTags', ...arguments)" /> - +