mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix "getNoteStartingWith" relic
This commit is contained in:
parent
a810c08c02
commit
d9550dd59b
@ -56,8 +56,7 @@ function getYearNote(dateStr, rootNote) {
|
|||||||
|
|
||||||
const yearStr = dateStr.substr(0, 4);
|
const yearStr = dateStr.substr(0, 4);
|
||||||
|
|
||||||
let yearNote = attributeService.getNoteWithLabel(YEAR_LABEL, yearStr)
|
let yearNote = attributeService.getNoteWithLabel(YEAR_LABEL, yearStr);
|
||||||
|| getNoteStartingWith(rootNote.noteId, yearStr);
|
|
||||||
|
|
||||||
if (yearNote) {
|
if (yearNote) {
|
||||||
return yearNote;
|
return yearNote;
|
||||||
@ -103,18 +102,12 @@ function getMonthNote(dateStr, rootNote) {
|
|||||||
return monthNote;
|
return monthNote;
|
||||||
}
|
}
|
||||||
|
|
||||||
const yearNote = getYearNote(dateStr, rootNote);
|
|
||||||
|
|
||||||
monthNote = getNoteStartingWith(yearNote.noteId, monthNumber);
|
|
||||||
|
|
||||||
if (monthNote) {
|
|
||||||
return monthNote;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dateObj = dateUtils.parseLocalDate(dateStr);
|
const dateObj = dateUtils.parseLocalDate(dateStr);
|
||||||
|
|
||||||
const noteTitle = getMonthNoteTitle(rootNote, monthNumber, dateObj);
|
const noteTitle = getMonthNoteTitle(rootNote, monthNumber, dateObj);
|
||||||
|
|
||||||
|
const yearNote = getYearNote(dateStr, rootNote);
|
||||||
|
|
||||||
sql.transactional(() => {
|
sql.transactional(() => {
|
||||||
monthNote = createNote(yearNote, noteTitle);
|
monthNote = createNote(yearNote, noteTitle);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user