1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Fixed limit issue

This commit is contained in:
Laurent Cozic
2017-08-20 10:16:31 +02:00
parent d708c8b48d
commit 1213819467
3 changed files with 5 additions and 3 deletions

View File

@ -151,6 +151,8 @@ class BaseModel {
params.push(pattern);
}
if ('limit' in options && options.limit <= 0) return [];
let sql = 'SELECT ' + this.db().escapeFields(options.fields) + ' FROM `' + this.tableName() + '`';
if (conditions.length) sql += ' WHERE ' + conditions.join(' AND ');

View File

@ -165,6 +165,7 @@ class Note extends BaseItem {
tempOptions = Object.assign({}, options);
tempOptions.conditions = cond;
if ('limit' in tempOptions) tempOptions.limit -= uncompletedTodos.length;
let theRest = await this.search(tempOptions);
return uncompletedTodos.concat(theRest);