1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-27 08:21:03 +02:00

All: Fix sorting by title in a case insensitive way

This commit is contained in:
Laurent Cozic 2020-11-27 15:16:50 +00:00
parent 56605beea2
commit 03942a0073
4 changed files with 3 additions and 9 deletions

View File

@ -6,5 +6,6 @@
],
"exclude": [
"**/node_modules",
"**/dist",
],
}

View File

@ -255,14 +255,6 @@ class BaseModel {
if (!options) options = {};
if (options.order && options.order.length) {
// const items = [];
// for (let i = 0; i < options.order.length; i++) {
// const o = options.order[i];
// let item = `\`${o.by}\``;
// if (options.caseInsensitive === true) item += ' COLLATE NOCASE';
// if (o.dir) item += ` ${o.dir}`;
// items.push(item);
// }
sql += ` ORDER BY ${paginationToSql(options)}`;
}

View File

@ -6,7 +6,7 @@ export default function(pagination: Pagination): string {
for (let i = 0; i < pagination.order.length; i++) {
const o = pagination.order[i];
let item = `\`${o.by}\``;
if (o.caseInsensitive === true) item += ' COLLATE NOCASE';
if (!!o.caseInsensitive || !!pagination.caseInsensitive) item += ' COLLATE NOCASE';
item += ` ${o.dir}`;
sql.push(item);
}

View File

@ -13,4 +13,5 @@ export interface Pagination {
limit: number;
order: PaginationOrder[];
page: number;
caseInsensitive?: boolean;
}