« get me outta code hell

move artistAliasData gen into artist data save() - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-02-27 21:04:29 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-02-27 21:04:29 -0400
commit45923cad4030a4f890a2780f05f7b4a4353d3229 (patch)
treec251252849deae6de34b08f2fb4985e17c2535d1
parent33c607bbdc8211cd32232bf50cdcf7eafbaf48a7 (diff)
move artistAliasData gen into artist data save()
-rwxr-xr-xsrc/upd8.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/upd8.js b/src/upd8.js
index eb2da684..9c218d41 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -2423,6 +2423,18 @@ async function main() {
 
             save(results) {
                 wikiData.artistData = results;
+
+                wikiData.artistAliasData = results.flatMap(artist => {
+                    const origRef = Thing.getReference(artist);
+                    return (artist.aliasNames?.map(name => {
+                        const alias = new Artist();
+                        alias.name = name;
+                        alias.isAlias = true;
+                        alias.aliasedArtistRef = origRef;
+                        alias.artistData = WD.artistData;
+                        return alias;
+                    }) ?? []);
+                });
             }
         },
 
@@ -2935,18 +2947,6 @@ async function main() {
     // appropriate.
     linkDataArrays();
 
-    WD.artistAliasData = wikiData.artistData.flatMap(artist => {
-        const origRef = Thing.getReference(artist);
-        return (artist.aliasNames?.map(name => {
-            const alias = new Artist();
-            alias.name = name;
-            alias.isAlias = true;
-            alias.aliasedArtistRef = origRef;
-            alias.artistData = WD.artistData;
-            return alias;
-        }) ?? []);
-    });
-
     // Filter out any reference errors throughout the data, warning about them
     // too.
     filterAndShowReferenceErrors();