mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
parent
61dd3180a4
commit
ac1f540763
4 changed files with 32 additions and 0 deletions
|
@ -102,6 +102,19 @@ Checklists.helpers({
|
|||
isFinished: true,
|
||||
}).count();
|
||||
},
|
||||
/** returns the finished percent of the checklist */
|
||||
finishedPercent() {
|
||||
const checklistItems = ChecklistItems.find({ checklistId: this._id });
|
||||
const count = checklistItems.count();
|
||||
const checklistItemsFinished = checklistItems.fetch().filter(checklistItem => checklistItem.isFinished);
|
||||
|
||||
let ret = 0;
|
||||
|
||||
if (count > 0) {
|
||||
ret = Math.round(checklistItemsFinished.length / count * 100);
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
isFinished() {
|
||||
return 0 !== this.itemCount() && this.itemCount() === this.finishedCount();
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue