Continued migration to nested sets
This commit is contained in:
@@ -42,6 +42,7 @@ import ColumnLayout from '/imports/client/ui/components/ColumnLayout.vue';
|
||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties';
|
||||
import PrintedSpell from '/imports/client/ui/creature/character/printedCharacterSheet/components/PrintedSpell.vue';
|
||||
import PrintedSpellList from '/imports/client/ui/creature/character/printedCharacterSheet/components/PrintedSpellList.vue';
|
||||
import { getFilter } from '/imports/api/parenting/parentingFunctions';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -60,23 +61,22 @@ export default {
|
||||
organize: false,
|
||||
}
|
||||
},
|
||||
// @ts-ignore-error Meteor not defined on vue
|
||||
meteor: {
|
||||
spellLists() {
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': this.creatureId,
|
||||
...getFilter.descendantsOfRoot(this.creatureId),
|
||||
type: 'spellList',
|
||||
removed: { $ne: true },
|
||||
inactive: { $ne: true },
|
||||
}, {
|
||||
sort: { order: 1 }
|
||||
});
|
||||
}).fetch();
|
||||
},
|
||||
spellsWithoutList() {
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': {
|
||||
$eq: this.creatureId,
|
||||
$nin: this.spellListIds,
|
||||
},
|
||||
...getFilter.descendantsOfRoot(this.creatureId),
|
||||
$not: getFilter.descendantsOfAll(this.spellLists),
|
||||
type: 'spell',
|
||||
removed: { $ne: true },
|
||||
deactivatedByAncestor: { $ne: true },
|
||||
@@ -90,10 +90,8 @@ export default {
|
||||
},
|
||||
spellListsWithoutAncestorSpellLists() {
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': {
|
||||
$eq: this.creatureId,
|
||||
$nin: this.spellListIds,
|
||||
},
|
||||
...getFilter.descendantsOfRoot(this.creatureId),
|
||||
$not: getFilter.descendantsOfAll(this.spellLists),
|
||||
type: 'spellList',
|
||||
removed: { $ne: true },
|
||||
inactive: { $ne: true },
|
||||
@@ -101,7 +99,7 @@ export default {
|
||||
sort: { order: 1 }
|
||||
}).map(sl => {
|
||||
sl.spells = CreatureProperties.find({
|
||||
'ancestors.id': sl._id,
|
||||
...getFilter.descendants(sl),
|
||||
type: 'spell',
|
||||
removed: { $ne: true },
|
||||
inactive: { $ne: true },
|
||||
|
||||
@@ -360,6 +360,7 @@ import PrintedSkill from '/imports/client/ui/creature/character/printedCharacter
|
||||
import PrintedDamageMultipliers from '/imports/client/ui/creature/character/printedCharacterSheet/components/PrintedDamageMultipliers.vue';
|
||||
import PropertyDescription from '/imports/client/ui/properties/viewers/shared/PropertyDescription.vue';
|
||||
import { uniqBy } from 'lodash';
|
||||
import { getFilter } from '/imports/api/parenting/parentingFunctions';
|
||||
|
||||
const getProperties = function (creature, filter, options = {
|
||||
sort: { order: 1 }
|
||||
@@ -368,7 +369,7 @@ const getProperties = function (creature, filter, options = {
|
||||
if (creature.settings.hideUnusedStats) {
|
||||
filter.hide = { $ne: true };
|
||||
}
|
||||
filter['ancestors.id'] = creature._id;
|
||||
filter['root.id'] = creature._id;
|
||||
filter.removed = { $ne: true };
|
||||
filter.inactive = { $ne: true };
|
||||
filter.overridden = { $ne: true };
|
||||
@@ -413,6 +414,7 @@ export default {
|
||||
doCheckLoading: false,
|
||||
}
|
||||
},
|
||||
//@ts-ignore-error Meteor not defined
|
||||
meteor: {
|
||||
creature() {
|
||||
return Creatures.findOne(this.creatureId, { fields: { settings: 1 } });
|
||||
@@ -425,7 +427,7 @@ export default {
|
||||
},
|
||||
toggles() {
|
||||
return CreatureProperties.find({
|
||||
'ancestors.id': this.creatureId,
|
||||
...getFilter.descendantsOfRoot(this.creatureId),
|
||||
type: 'toggle',
|
||||
removed: { $ne: true },
|
||||
deactivatedByAncestor: { $ne: true },
|
||||
|
||||
Reference in New Issue
Block a user