Merge pull request #66 from lae/fix/bulk-import-failure

Import terms with transactional adds instead of bulkAdd
This commit is contained in:
Alex Yatskov 2017-07-27 14:28:28 -07:00 committed by GitHub
commit 9be66c7e7b

View File

@ -189,9 +189,9 @@ class Database {
};
const termsLoaded = (title, entries, total, current) => {
const rows = [];
return this.db.transaction('rw', this.db.terms, function() {
for (const [expression, reading, tags, rules, score, ...glossary] of entries) {
rows.push({
this.db.terms.add({
expression,
reading,
tags,
@ -201,8 +201,7 @@ class Database {
dictionary: title
});
}
return this.db.terms.bulkAdd(rows).then(() => {
}).then(() => {
if (callback) {
callback(total, current);
}