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/util/wiki-data.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/util/wiki-data.js') diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js index ac652b2..0790ae9 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