From 114017147fb6c52ad2c561d5f59cc9d99d45fb43 Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 15 Mar 2020 17:18:50 +0100 Subject: [PATCH] fix load results isEmpty method --- db/schema.sql | 4 ++-- src/public/javascripts/services/load_results.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/db/schema.sql b/db/schema.sql index 8c766571f..f5024a097 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -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", diff --git a/src/public/javascripts/services/load_results.js b/src/public/javascripts/services/load_results.js index 8cdbaaa0a..678afdc33 100644 --- a/src/public/javascripts/services/load_results.js +++ b/src/public/javascripts/services/load_results.js @@ -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; } } \ No newline at end of file