mirror of
https://github.com/zadam/trilium.git
synced 2025-01-17 04:27:56 +08:00
small fixes
This commit is contained in:
parent
c94fb7a62d
commit
56506d33a7
3 changed files with 8 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const noteCache = require('../../services/note_cache/note_cache');
|
const noteCache = require('../../services/note_cache/note_cache');
|
||||||
|
const log = require('../../services/log');
|
||||||
|
|
||||||
function getNotesAndBranchesAndAttributes(noteIds) {
|
function getNotesAndBranchesAndAttributes(noteIds) {
|
||||||
noteIds = new Set(noteIds);
|
noteIds = new Set(noteIds);
|
||||||
|
@ -76,6 +77,11 @@ function getNotesAndBranchesAndAttributes(noteIds) {
|
||||||
for (const branchId of collectedBranchIds) {
|
for (const branchId of collectedBranchIds) {
|
||||||
const branch = noteCache.branches[branchId];
|
const branch = noteCache.branches[branchId];
|
||||||
|
|
||||||
|
if (!branch) {
|
||||||
|
log.error(`Could not find branch for branchId=${branchId}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
branches.push({
|
branches.push({
|
||||||
branchId: branch.branchId,
|
branchId: branch.branchId,
|
||||||
noteId: branch.noteId,
|
noteId: branch.noteId,
|
||||||
|
|
|
@ -152,12 +152,11 @@ function getDateNoteTitle(rootNote, dayNumber, dateObj) {
|
||||||
function getDateNote(dateStr) {
|
function getDateNote(dateStr) {
|
||||||
const rootNote = getRootCalendarNote();
|
const rootNote = getRootCalendarNote();
|
||||||
|
|
||||||
const dayNumber = dateStr.substr(8, 2);
|
|
||||||
|
|
||||||
let dateNote = attributeService.getNoteWithLabel(DATE_LABEL, dateStr);
|
let dateNote = attributeService.getNoteWithLabel(DATE_LABEL, dateStr);
|
||||||
|
|
||||||
if (!dateNote) {
|
if (!dateNote) {
|
||||||
const monthNote = getMonthNote(dateStr, rootNote);
|
const monthNote = getMonthNote(dateStr, rootNote);
|
||||||
|
const dayNumber = dateStr.substr(8, 2);
|
||||||
|
|
||||||
dateNote = getNoteStartingWith(monthNote.noteId, dayNumber);
|
dateNote = getNoteStartingWith(monthNote.noteId, dayNumber);
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ function findNotesWithExpression(expression, searchContext) {
|
||||||
|
|
||||||
const searchResults = noteSet.notes
|
const searchResults = noteSet.notes
|
||||||
.map(note => executionContext.noteIdToNotePath[note.noteId] || noteCacheService.getSomePath(note))
|
.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));
|
.map(notePathArray => new SearchResult(notePathArray));
|
||||||
|
|
||||||
for (const res of searchResults) {
|
for (const res of searchResults) {
|
||||||
|
|
Loading…
Reference in a new issue