diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-09-23 13:31:03 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-09-23 13:31:03 -0700 |
commit | 8651c11d361660426ecb4cc63c7ff29d56024699 (patch) | |
tree | e627f1c25337d83d9d523cd9e3ea3e5b781a3665 | |
parent | e5905dd732d4ffd0915ae27cb3b0c84256482443 (diff) |
frequency fixup
-rw-r--r-- | ext/bg/js/translator.js | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 21881cf3..c915dbc0 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -143,8 +143,7 @@ class Translator { definition.stats = await this.expandStats(definition.stats, definition.dictionary); definition.frequencies = []; - const metas = await this.database.findKanjiMeta(definition.character, titles); - for (const meta of metas) { + for (const meta of await this.database.findKanjiMeta(definition.character, titles)) { if (meta.mode === 'freq') { definition.frequencies.push({ character: meta.character, @@ -159,13 +158,8 @@ class Translator { } async buildTermFrequencies(definition, titles) { - let metas = await this.database.findTermMeta(definition.expression, titles); - if (metas.length === 0) { - metas = await this.database.findTermMeta(definition.reading, titles); - } - definition.frequencies = []; - for (const meta of metas) { + for (const meta of await this.database.findTermMeta(definition.expression, titles)) { if (meta.mode === 'freq') { definition.frequencies.push({ expression: meta.expression, |