« get me outta code hell

quarantine hard-coded official/fandomAlbumData - 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-01-07 21:47:34 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-01-07 21:47:34 -0400
commit782a63e25304b7f17b216a231d243f3154ae1128 (patch)
treeb867d1fddba0cf1603c847c25ef18058dc9e67fa /src
parent5b7a195b7075ee83501aeb65a421a81c3e360542 (diff)
quarantine hard-coded official/fandomAlbumData
Diffstat (limited to 'src')
-rw-r--r--src/listing-spec.js12
-rwxr-xr-xsrc/upd8.js12
-rw-r--r--src/util/magic-constants.js1
3 files changed, 10 insertions, 15 deletions
diff --git a/src/listing-spec.js b/src/listing-spec.js
index 636e5f67..1538757c 100644
--- a/src/listing-spec.js
+++ b/src/listing-spec.js
@@ -1,3 +1,5 @@
+import {OFFICIAL_GROUP_DIRECTORY} from './util/magic-constants.js';
+
 import {
   empty,
   accumulateSum,
@@ -876,16 +878,20 @@ const listingSpec = [
     directory: 'random',
     stringsKey: 'other.randomPages',
 
-    data: ({wikiData: {fandomAlbumData, officialAlbumData}}) => [
+    data: ({wikiData: {albumData}}) => [
       {
-        albums: officialAlbumData,
         name: 'Official',
         randomCode: 'official',
+        albums: albumData
+          .filter((album) => album.groups
+            .some((group) => group.directory === OFFICIAL_GROUP_DIRECTORY)),
       },
       {
-        albums: fandomAlbumData,
         name: 'Fandom',
         randomCode: 'fandom',
+        albums: albumData
+          .filter((album) => album.groups
+            .every((group) => group.directory !== OFFICIAL_GROUP_DIRECTORY)),
       },
     ],
 
diff --git a/src/upd8.js b/src/upd8.js
index 6d6990bf..d5a5c2a7 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -112,9 +112,6 @@ import {
 } from './util/serialize.js';
 */
 
-// Pensive emoji!
-import { OFFICIAL_GROUP_DIRECTORY } from './util/magic-constants.js';
-
 import FileSizePreloader from './file-size-preloader.js';
 
 const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -495,9 +492,7 @@ async function main() {
     progressCallAll('Caching all data values', Object.entries(wikiData)
       .filter(([key]) =>
         key !== 'listingSpec' &&
-        key !== 'listingTargetSpec' &&
-        key !== 'officialAlbumData' &&
-        key !== 'fandomAlbumData')
+        key !== 'listingTargetSpec')
       .map(([key, value]) =>
         key === 'wikiInfo' ? [key, [value]] :
         key === 'homepageLayout' ? [key, [value]] :
@@ -589,11 +584,6 @@ async function main() {
     }
   }
 
-  wikiData.officialAlbumData = wikiData.albumData
-    .filter((album) => album.groups.some((group) => group.directory === OFFICIAL_GROUP_DIRECTORY));
-  wikiData.fandomAlbumData = wikiData.albumData
-    .filter((album) => album.groups.every((group) => group.directory !== OFFICIAL_GROUP_DIRECTORY));
-
   const urls = generateURLs(urlSpec);
 
   const fileSizePreloader = new FileSizePreloader();
diff --git a/src/util/magic-constants.js b/src/util/magic-constants.js
index 73fdbc6d..83dd7db5 100644
--- a/src/util/magic-constants.js
+++ b/src/util/magic-constants.js
@@ -7,4 +7,3 @@
 // (TM).
 
 export const OFFICIAL_GROUP_DIRECTORY = 'official';
-export const FANDOM_GROUP_DIRECTORY = 'fandom';