mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix for "Today page does not work for 2021-11-20", closes #2359
This commit is contained in:
parent
d64c14482b
commit
40fb4ff56b
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.48.6",
|
"version": "0.48.7",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -62,6 +62,7 @@ const BUILTIN_ATTRIBUTES = [
|
|||||||
{ type: 'relation', name: 'renderNote', isDangerous: true }
|
{ type: 'relation', name: 'renderNote', isDangerous: true }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @returns {Note[]} */
|
||||||
function getNotesWithLabel(name, value) {
|
function getNotesWithLabel(name, value) {
|
||||||
const query = formatAttrForSearch({type: 'label', name, value}, true);
|
const query = formatAttrForSearch({type: 'label', name, value}, true);
|
||||||
return searchService.searchNotes(query, {
|
return searchService.searchNotes(query, {
|
||||||
@ -71,6 +72,7 @@ function getNotesWithLabel(name, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: should be in search service
|
// TODO: should be in search service
|
||||||
|
/** @returns {Note|null} */
|
||||||
function getNoteWithLabel(name, value) {
|
function getNoteWithLabel(name, value) {
|
||||||
// optimized version (~20 times faster) without using normal search, useful for e.g. finding date notes
|
// optimized version (~20 times faster) without using normal search, useful for e.g. finding date notes
|
||||||
const attrs = becca.findAttributes('label', name);
|
const attrs = becca.findAttributes('label', name);
|
||||||
|
@ -25,15 +25,6 @@ function createNote(parentNote, noteTitle) {
|
|||||||
}).note;
|
}).note;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNoteStartingWith(parentNoteId, startsWith) {
|
|
||||||
const noteId = sql.getValue(`SELECT notes.noteId FROM notes JOIN branches USING(noteId)
|
|
||||||
WHERE parentNoteId = ? AND title LIKE '${startsWith}%'
|
|
||||||
AND notes.isDeleted = 0 AND isProtected = 0
|
|
||||||
AND branches.isDeleted = 0`, [parentNoteId]);
|
|
||||||
|
|
||||||
return becca.getNote(noteId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @returns {Note} */
|
/** @returns {Note} */
|
||||||
function getRootCalendarNote() {
|
function getRootCalendarNote() {
|
||||||
let rootNote = attributeService.getNoteWithLabel(CALENDAR_ROOT_LABEL);
|
let rootNote = attributeService.getNoteWithLabel(CALENDAR_ROOT_LABEL);
|
||||||
@ -164,12 +155,6 @@ function getDateNote(dateStr) {
|
|||||||
const monthNote = getMonthNote(dateStr, rootNote);
|
const monthNote = getMonthNote(dateStr, rootNote);
|
||||||
const dayNumber = dateStr.substr(8, 2);
|
const dayNumber = dateStr.substr(8, 2);
|
||||||
|
|
||||||
dateNote = getNoteStartingWith(monthNote.noteId, dayNumber);
|
|
||||||
|
|
||||||
if (dateNote) {
|
|
||||||
return dateNote;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dateObj = dateUtils.parseLocalDate(dateStr);
|
const dateObj = dateUtils.parseLocalDate(dateStr);
|
||||||
|
|
||||||
const noteTitle = getDateNoteTitle(rootNote, dayNumber, dateObj);
|
const noteTitle = getDateNoteTitle(rootNote, dayNumber, dateObj);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user