From 9899727d7d53caed4c5b5e68176f7ed7f90a9438 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 26 Sep 2021 11:08:16 -0400 Subject: Frequency dictionary sort (#1938) * Add sortDictionary/sortDictionaryOrder options * Update options * Add API.getTermFrequencies * Add settings * Implement frequency dictionary sorting * Update test * Update test data * Fix handling of undefined rank-based frequencies --- ext/js/data/options-util.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'ext/js/data') diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index 30ffadb1..c8ab2d01 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -463,7 +463,8 @@ class OptionsUtil { {async: false, update: this._updateVersion11.bind(this)}, {async: true, update: this._updateVersion12.bind(this)}, {async: true, update: this._updateVersion13.bind(this)}, - {async: false, update: this._updateVersion14.bind(this)} + {async: false, update: this._updateVersion14.bind(this)}, + {async: false, update: this._updateVersion15.bind(this)} ]; if (typeof targetVersion === 'number' && targetVersion < result.length) { result.splice(targetVersion); @@ -876,4 +877,15 @@ class OptionsUtil { } return options; } + + _updateVersion15(options) { + // Version 15 changes: + // Added general.sortFrequencyDictionary. + // Added general.sortFrequencyDictionaryOrder. + for (const profile of options.profiles) { + profile.options.general.sortFrequencyDictionary = null; + profile.options.general.sortFrequencyDictionaryOrder = 'descending'; + } + return options; + } } -- cgit v1.2.3