« get me outta code hell

data: use flash act directory for better determinism - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-11 14:49:43 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-11 14:49:43 -0300
commite842ce93e6405334b6ef475ec1db41e051cfd2b5 (patch)
treea745c6330a0182de1c6323cea9f70ff8bf877d39 /src
parent3a871cf43a11b87392d26320c736b516925da684 (diff)
data: use flash act directory for better determinism
Diffstat (limited to 'src')
-rw-r--r--src/data/yaml.js1
-rw-r--r--src/util/wiki-data.js15
2 files changed, 3 insertions, 13 deletions
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...