implemented "targetRelationCount" and exposed more of them in order by widget, fixes #1658

This commit is contained in:
zadam
2021-02-19 20:42:34 +01:00
parent 2cfd093cae
commit 4160da70be
5 changed files with 49 additions and 0 deletions

View File

@@ -319,14 +319,42 @@ class Note {
return this.attributes.filter(attr => attr.type === 'label').length;
}
get ownedLabelCount() {
return this.ownedAttributes.filter(attr => attr.type === 'label').length;
}
get relationCount() {
return this.attributes.filter(attr => attr.type === 'relation' && !attr.isAutoLink()).length;
}
get relationCountIncludingLinks() {
return this.attributes.filter(attr => attr.type === 'relation').length;
}
get ownedRelationCount() {
return this.ownedAttributes.filter(attr => attr.type === 'relation' && !attr.isAutoLink()).length;
}
get ownedRelationCountIncludingLinks() {
return this.ownedAttributes.filter(attr => attr.type === 'relation').length;
}
get targetRelationCount() {
return this.targetRelations.filter(attr => !attr.isAutoLink()).length;
}
get targetRelationCountIncludingLinks() {
return this.targetRelations.length;
}
get attributeCount() {
return this.attributes.length;
}
get ownedAttributeCount() {
return this.attributes.length;
}
get ancestors() {
if (!this.ancestorCache) {
const noteIds = new Set();