From 0e663f36db258c96673bb16c1f7405e98b39766f Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Tue, 12 Jan 2021 13:22:48 +0200 Subject: [PATCH] Slot fillers that count as more than one slot now update the space left correctly. Slot fillers removed from a library can no longer be added to a slot. If a slot has limited space left, this will be reflected on the error finding slots message --- .../api/creature/denormalise/recomputeSlotFullness.js | 6 +++++- app/imports/server/publications/slotFillers.js | 1 + app/imports/ui/creature/slots/SlotFillDialog.vue | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/imports/api/creature/denormalise/recomputeSlotFullness.js b/app/imports/api/creature/denormalise/recomputeSlotFullness.js index 3da2320b..bc7a073f 100644 --- a/app/imports/api/creature/denormalise/recomputeSlotFullness.js +++ b/app/imports/api/creature/denormalise/recomputeSlotFullness.js @@ -9,10 +9,14 @@ export default function recomputeSlotFullness(ancestorId){ 'parent.id': slot._id, removed: {$ne: true}, }, { - fields: {slotQuantityFilled: 1} + fields: { + slotQuantityFilled: 1, + type: 1 + } }).fetch(); let totalFilled = 0; children.forEach(child => { + console.log(child); if (child.type === 'slotFiller'){ totalFilled += child.slotQuantityFilled; } else { diff --git a/app/imports/server/publications/slotFillers.js b/app/imports/server/publications/slotFillers.js index 27b5b185..9f3293c2 100644 --- a/app/imports/server/publications/slotFillers.js +++ b/app/imports/server/publications/slotFillers.js @@ -33,6 +33,7 @@ Meteor.publish('slotFillers', function(slotId){ // Build a filter for nodes in those libraries that match the slot let filter = { 'ancestors.id': {$in: libraryIds}, + removed: {$ne: true}, }; if (slot.slotTags && slot.slotTags.length){ filter.tags = {$all: slot.slotTags}; diff --git a/app/imports/ui/creature/slots/SlotFillDialog.vue b/app/imports/ui/creature/slots/SlotFillDialog.vue index 52c319ab..edfe5278 100644 --- a/app/imports/ui/creature/slots/SlotFillDialog.vue +++ b/app/imports/ui/creature/slots/SlotFillDialog.vue @@ -67,6 +67,9 @@ {{ tag }}, + + that fills less than {{ model.spaceLeft }} slots +