fix load results isEmpty method

This commit is contained in:
zadam 2020-03-15 17:18:50 +01:00
parent 2cc0442ef2
commit 114017147f
2 changed files with 10 additions and 10 deletions

View file

@ -3,8 +3,6 @@ CREATE TABLE IF NOT EXISTS "source_ids" (
`utcDateCreated` TEXT NOT NULL,
PRIMARY KEY(`sourceId`)
);
CREATE INDEX IDX_source_ids_utcDateCreated
on source_ids (utcDateCreated);
CREATE TABLE IF NOT EXISTS "api_tokens"
(
apiTokenId TEXT PRIMARY KEY NOT NULL,
@ -59,6 +57,8 @@ CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCr
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);
CREATE INDEX IDX_source_ids_utcDateCreated
on source_ids (utcDateCreated);
CREATE TABLE IF NOT EXISTS "notes" (
`noteId` TEXT NOT NULL,
`title` TEXT NOT NULL DEFAULT "note",

View file

@ -18,7 +18,7 @@ export default class LoadResults {
this.options = [];
}
addNote(noteId, sourceId) {
addNote(noteId, sourceId) {console.log("Adding", noteId, sourceId);
this.noteIdToSourceId[noteId] = this.noteIdToSourceId[noteId] || [];
if (!this.noteIdToSourceId[noteId].includes(sourceId)) {
@ -102,12 +102,12 @@ export default class LoadResults {
}
isEmpty() {
return Object.keys(this.noteIdToSourceId).length > 0
|| this.branches.length > 0
|| this.attributes.length > 0
|| this.noteReorderings.length > 0
|| this.noteRevisions.length > 0
|| this.contentNoteIdToSourceId.length > 0
|| this.options.length > 0;
return Object.keys(this.noteIdToSourceId).length === 0
&& this.branches.length === 0
&& this.attributes.length === 0
&& this.noteReorderings.length === 0
&& this.noteRevisions.length === 0
&& this.contentNoteIdToSourceId.length === 0
&& this.options.length === 0;
}
}