fix "getNoteStartingWith" relic

This commit is contained in:
zadam 2021-12-11 14:15:38 +01:00
parent a810c08c02
commit d9550dd59b

View File

@ -56,8 +56,7 @@ function getYearNote(dateStr, rootNote) {
const yearStr = dateStr.substr(0, 4);
let yearNote = attributeService.getNoteWithLabel(YEAR_LABEL, yearStr)
|| getNoteStartingWith(rootNote.noteId, yearStr);
let yearNote = attributeService.getNoteWithLabel(YEAR_LABEL, yearStr);
if (yearNote) {
return yearNote;
@ -103,18 +102,12 @@ function getMonthNote(dateStr, rootNote) {
return monthNote;
}
const yearNote = getYearNote(dateStr, rootNote);
monthNote = getNoteStartingWith(yearNote.noteId, monthNumber);
if (monthNote) {
return monthNote;
}
const dateObj = dateUtils.parseLocalDate(dateStr);
const noteTitle = getMonthNoteTitle(rootNote, monthNumber, dateObj);
const yearNote = getYearNote(dateStr, rootNote);
sql.transactional(() => {
monthNote = createNote(yearNote, noteTitle);