Merge pull request #3765 from HappyMushroom-TechTeam/feature/miniCard_subtaskCount

Feature/mini card subtask count
This commit is contained in:
Lauri Ojansivu 2021-04-28 12:18:03 +03:00 committed by GitHub
commit 39ece35f52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 26 deletions

View file

@ -129,3 +129,8 @@ template(name="minicard")
.badge(class="{{#if checklistFinished}}is-finished{{/if}}")
span.badge-icon.fa.fa-check-square-o
span.badge-text.check-list-text {{checklistFinishedCount}}/{{checklistItemCount}}
if allSubtasks.count
.badge
span.badge-icon.fa.fa-sitemap
span.badge-text.check-list-text {{subtasksFinishedCount}}/{{allSubtasksCount}}
//{{subtasksFinishedCount}}/{{subtasksCount}} does not work because when a subtaks is archived, the count goes down

View file

@ -641,37 +641,32 @@ Cards.helpers({
);
},
allSubtasks() {
return Cards.find(
{
parentId: this._id,
archived: false,
},
{
sort: {
sort: 1,
},
},
);
},
subtasksCount() {
return Cards.find({
parentId: this._id,
archived: false,
}).count();
},
subtasksFinishedCount() {
subtasksFinished() {
return Cards.find({
parentId: this._id,
archived: true,
}).count();
});
},
subtasksFinished() {
const finishCount = this.subtasksFinishedCount();
return finishCount > 0 && this.subtasksCount() === finishCount;
allSubtasks() {
return Cards.find({
parentId: this._id
});
},
subtasksCount() {
const subtasks = this.subtasks();
return subtasks.count();
},
subtasksFinishedCount() {
const subtasksArchived = this.subtasksFinished();
return subtasksArchived.count();
},
allSubtasksCount() {
const allSubtasks = this.allSubtasks();
return allSubtasks.count();
},
allowsSubtasks() {