Merge pull request #3551 from mfilser/checklistitems-not_always_insert_at_the_end

Checklistitems are now inserted always at the end of the checklist
This commit is contained in:
Lauri Ojansivu 2021-02-09 20:35:32 +02:00 committed by GitHub
commit 89be0f80b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -111,7 +111,7 @@ BlazeComponent.extendComponent({
title,
checklistId: checklist._id,
cardId: checklist.cardId,
sort: checklist.itemCount(),
sort: Utils.calculateIndexData(checklist.lastItem()).base,
});
}
// We keep the form opened, empty it.

View file

@ -91,6 +91,11 @@ Checklists.helpers({
{ sort: ['sort'] },
);
},
lastItem() {
const allItems = this.items().fetch();
const ret = allItems[allItems.length - 1];
return ret;
},
finishedCount() {
return ChecklistItems.find({
checklistId: this._id,