diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-10-29 10:59:50 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-10-29 10:59:50 -0700 |
commit | d6603fd03155939ba98e8e74f98d1c5ce7ca9b0f (patch) | |
tree | 8af7349a45627dc09e11674fb63afed5677d330b /ext/bg/js/database.js | |
parent | c62cc01642b29c13a38f3bcc08f2fa144107c158 (diff) |
include sequence property in header data
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r-- | ext/bg/js/database.js | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 14b3243a..e63d95de 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -233,7 +233,7 @@ class Database { throw 'Database not initialized'; } - const indexDataValid = async summary => { + const indexDataLoaded = async summary => { if (summary.version > 2) { throw 'Unsupported dictionary version'; } @@ -242,9 +242,7 @@ class Database { if (count > 0) { throw 'Dictionary is already imported'; } - }; - const indexDataLoaded = async summary => { await this.db.dictionaries.add(summary); }; @@ -282,8 +280,6 @@ class Database { } } - summary.hasSequences = rows.every(row => row.sequence >= 0); - await this.db.terms.bulkAdd(rows); }; @@ -381,7 +377,6 @@ class Database { return await Database.importDictionaryZip( archive, - indexDataValid, indexDataLoaded, termDataLoaded, termMetaDataLoaded, @@ -393,7 +388,6 @@ class Database { static async importDictionaryZip( archive, - indexDataValid, indexDataLoaded, termDataLoaded, termMetaDataLoaded, @@ -416,10 +410,11 @@ class Database { const summary = { title: index.title, revision: index.revision, + sequenced: index.sequenced, version: index.format || index.version }; - await indexDataValid(summary); + await indexDataLoaded(summary); const buildTermBankName = index => `term_bank_${index + 1}.json`; const buildTermMetaBankName = index => `term_meta_bank_${index + 1}.json`; @@ -476,10 +471,6 @@ class Database { await loadBank(summary, buildKanjiMetaBankName, kanjiMetaBankCount, kanjiMetaDataLoaded); await loadBank(summary, buildTagBankName, tagBankCount, tagDataLoaded); - if (indexDataLoaded) { - await indexDataLoaded(summary); - } - return summary; } } |