From e842ce93e6405334b6ef475ec1db41e051cfd2b5 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 11 Oct 2023 14:49:43 -0300 Subject: data: use flash act directory for better determinism --- src/data/yaml.js | 1 + src/util/wiki-data.js | 15 ++------------- 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/data/yaml.js b/src/data/yaml.js index 0ecc1f1e..a2811d43 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -1391,6 +1391,7 @@ export function filterDuplicateDirectories(wikiData) { 'albumData', 'artTagData', 'flashData', + 'flashActData', 'groupData', 'newsData', 'trackData', diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js index ac652b27..0790ae91 100644 --- a/src/util/wiki-data.js +++ b/src/util/wiki-data.js @@ -610,20 +610,9 @@ export function sortFlashesChronologically(data, { latestFirst = false, getDate, } = {}) { - // Flash acts don't actually have any identifying properties because they - // don't have dedicated pages (yet), so don't have a directory. Make up a - // fake key identifying them so flashes can be grouped together. - const flashActs = new Set(data.map(flash => flash.act)); - const flashActIdentifiers = new Map(); - - let counter = 0; - for (const act of flashActs) { - flashActIdentifiers.set(act, ++counter); - } - // Group flashes by act... - data.sort((a, b) => { - return flashActIdentifiers.get(a.act) - flashActIdentifiers.get(b.act); + sortByDirectory(data, { + getDirectory: flash => flash.act.directory, }); // Sort flashes by position in act... -- cgit 1.3.0-6-gf8a5