mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 23:42:12 +00:00
Task filter now searches checklists
This commit is contained in:
parent
07541ea7e4
commit
8ba621795a
2 changed files with 16 additions and 0 deletions
|
|
@ -51,5 +51,14 @@ describe('Task Ordering Filters', function() {
|
|||
expect(filter('filterByTextAndNotes')(tasks, 'bar')).to.eql([tasks[1]]);
|
||||
expect(filter('filterByTextAndNotes')(tasks, 'foo')).to.eql([tasks[0], tasks[1]]);
|
||||
});
|
||||
|
||||
it('filters items by checklists', function () {
|
||||
var tasks = [
|
||||
{ text: 'foo' },
|
||||
{ text: 'foo', notes: 'bar', checklist: [ {text: "checkListToFind"} ] }
|
||||
];
|
||||
|
||||
expect(filter('filterByTextAndNotes')(tasks, 'checkListToFind')).to.eql([tasks[1]]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,6 +22,13 @@ angular.module('habitrpg')
|
|||
for (var i = 0; i < input.length; i++) {
|
||||
if (term.test(input[i].text) || term.test(input[i].notes)) {
|
||||
result.push(input[i]);
|
||||
}else if (input[i].checklist) {
|
||||
var checkListLen = input[i].checklist.length;
|
||||
for (var j = 0; j < checkListLen; j++) {
|
||||
if ( term.test(input[i].checklist[j].text) ) {
|
||||
result.push(input[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue