small fixes

This commit is contained in:
zadam 2021-02-19 22:58:53 +01:00
parent c94fb7a62d
commit 56506d33a7
3 changed files with 8 additions and 3 deletions

View file

@ -1,6 +1,7 @@
"use strict";
const noteCache = require('../../services/note_cache/note_cache');
const log = require('../../services/log');
function getNotesAndBranchesAndAttributes(noteIds) {
noteIds = new Set(noteIds);
@ -76,6 +77,11 @@ function getNotesAndBranchesAndAttributes(noteIds) {
for (const branchId of collectedBranchIds) {
const branch = noteCache.branches[branchId];
if (!branch) {
log.error(`Could not find branch for branchId=${branchId}`);
continue;
}
branches.push({
branchId: branch.branchId,
noteId: branch.noteId,

View file

@ -152,12 +152,11 @@ function getDateNoteTitle(rootNote, dayNumber, dateObj) {
function getDateNote(dateStr) {
const rootNote = getRootCalendarNote();
const dayNumber = dateStr.substr(8, 2);
let dateNote = attributeService.getNoteWithLabel(DATE_LABEL, dateStr);
if (!dateNote) {
const monthNote = getMonthNote(dateStr, rootNote);
const dayNumber = dateStr.substr(8, 2);
dateNote = getNoteStartingWith(monthNote.noteId, dayNumber);

View file

@ -88,7 +88,7 @@ function findNotesWithExpression(expression, searchContext) {
const searchResults = noteSet.notes
.map(note => executionContext.noteIdToNotePath[note.noteId] || noteCacheService.getSomePath(note))
.filter(notePathArray => notePathArray.includes(cls.getHoistedNoteId()))
.filter(notePathArray => notePathArray && notePathArray.includes(cls.getHoistedNoteId()))
.map(notePathArray => new SearchResult(notePathArray));
for (const res of searchResults) {