Skip to content

Commit

Permalink
fix "getNoteStartingWith" relic
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Dec 11, 2021
1 parent a810c08 commit d9550dd
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/services/date_notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit d9550dd

Please sign in to comment.