frequency fixup

This commit is contained in:
Alex Yatskov 2017-09-23 13:31:03 -07:00
parent e5905dd732
commit 8651c11d36

View File

@ -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,