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
This commit is contained in:
Stefan Zermatten
2021-01-12 13:22:48 +02:00
parent de9ea5922c
commit 0e663f36db
3 changed files with 12 additions and 2 deletions

View File

@@ -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 {

View File

@@ -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};

View File

@@ -67,6 +67,9 @@
<code>{{ tag }}</code>,
</span>
</template>
<span v-if="model.spaceLeft">
that fills less than {{ model.spaceLeft }} slots
</span>
</p>
</div>
<div
@@ -166,7 +169,9 @@ export default {
return Creatures.findOne(this.creatureId);
},
libraryNodes(){
let filter = {};
let filter = {
removed: {$ne: true},
};
if (this.model.slotTags && this.model.slotTags.length){
filter.tags = {$all: this.model.slotTags};
}