This commit is contained in:
Alex Yatskov 2016-12-17 23:38:14 -08:00
parent d44f0c5764
commit e5275560ce
2 changed files with 6 additions and 2 deletions

View File

@ -47,6 +47,7 @@ class Database {
this.db.close(); this.db.close();
return this.db.delete().then(() => { return this.db.delete().then(() => {
this.db = null; this.db = null;
this.tagMetaCache = {};
this.prepare(); this.prepare();
}); });
} }
@ -93,6 +94,7 @@ class Database {
onyomi: splitField(row.onyomi), onyomi: splitField(row.onyomi),
kunyomi: splitField(row.kunyomi), kunyomi: splitField(row.kunyomi),
tags: splitField(row.tags), tags: splitField(row.tags),
dictionary: row.dictionary,
glossary: row.meanings glossary: row.meanings
}); });
} }
@ -214,6 +216,8 @@ class Database {
return this.db.tagMeta.where('dictionary').equals(title).delete(); return this.db.tagMeta.where('dictionary').equals(title).delete();
}).then(() => { }).then(() => {
return this.db.dictionaries.where('title').equals(title).delete(); return this.db.dictionaries.where('title').equals(title).delete();
}).then(() => {
delete this.cacheTagMeta[title];
}); });
} }
@ -238,7 +242,7 @@ class Database {
name: tag, name: tag,
category: meta.category || 'default', category: meta.category || 'default',
notes: meta.notes || '', notes: meta.notes || '',
order: meta.order || Number.MAX_SAFE_INTEGER, order: meta.order || 0,
dictionary: title dictionary: title
}); });
} }

View File

@ -154,7 +154,7 @@ class Translator {
processKanji(definitions) { processKanji(definitions) {
for (const definition of definitions) { for (const definition of definitions) {
const tags = definitions.tags.map(tag => buildTag(tag, definition.tagMeta)); const tags = definition.tags.map(tag => buildTag(tag, definition.tagMeta));
definition.tags = sortTags(tags); definition.tags = sortTags(tags);
} }