From 0fc8578dee8f45e0891d753829216c0d5f584484 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 5 Dec 2020 21:16:24 -0500 Subject: [PATCH] Fix pitch accent info gathering using new data format (#1081) --- ext/mixed/js/dictionary-data-util.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ext/mixed/js/dictionary-data-util.js b/ext/mixed/js/dictionary-data-util.js index 709f4ead..761bfc1c 100644 --- a/ext/mixed/js/dictionary-data-util.js +++ b/ext/mixed/js/dictionary-data-util.js @@ -17,20 +17,17 @@ class DictionaryDataUtil { static getPitchAccentInfos(definition) { - const {type} = definition; - if (type === 'kanji') { return []; } + if (definition.type === 'kanji') { return []; } const results = new Map(); const allExpressions = new Set(); const allReadings = new Set(); - const sources = [definition]; - for (const {pitches: expressionPitches, expression} of sources) { + for (const {expression, reading, pitches: expressionPitches} of definition.expressions) { allExpressions.add(expression); + allReadings.add(reading); - for (const {reading, pitches, dictionary} of expressionPitches) { - allReadings.add(reading); - + for (const {pitches, dictionary} of expressionPitches) { let dictionaryResults = results.get(dictionary); if (typeof dictionaryResults === 'undefined') { dictionaryResults = [];