« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/listAlbumsByDuration.js10
-rw-r--r--src/content/dependencies/listAlbumsByTracks.js9
-rw-r--r--src/content/dependencies/listArtistsByCommentaryEntries.js8
-rw-r--r--src/content/dependencies/listArtistsByContributions.js9
-rw-r--r--src/content/dependencies/listArtistsByDuration.js10
-rw-r--r--src/content/dependencies/listGroupsByAlbums.js8
-rw-r--r--src/content/dependencies/listGroupsByDuration.js10
-rw-r--r--src/content/dependencies/listGroupsByTracks.js9
-rw-r--r--src/content/dependencies/listTagsByUses.js17
9 files changed, 71 insertions, 19 deletions
diff --git a/src/content/dependencies/listAlbumsByDuration.js b/src/content/dependencies/listAlbumsByDuration.js
index 650a5d1e..3ef5f373 100644
--- a/src/content/dependencies/listAlbumsByDuration.js
+++ b/src/content/dependencies/listAlbumsByDuration.js
@@ -1,5 +1,11 @@
 import {stitchArrays} from '../../util/sugar.js';
-import {filterByCount, getTotalDuration, sortByCount} from '../../util/wiki-data.js';
+
+import {
+  filterByCount,
+  getTotalDuration,
+  sortAlphabetically,
+  sortByCount,
+} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: ['generateListingPage', 'linkAlbum'],
@@ -10,7 +16,7 @@ export default {
   },
 
   query({albumData}, spec) {
-    const albums = albumData.slice();
+    const albums = sortAlphabetically(albumData.slice());
     const durations = albums.map(album => getTotalDuration(album.tracks));
 
     filterByCount(albums, durations);
diff --git a/src/content/dependencies/listAlbumsByTracks.js b/src/content/dependencies/listAlbumsByTracks.js
index c31609bd..d28a564e 100644
--- a/src/content/dependencies/listAlbumsByTracks.js
+++ b/src/content/dependencies/listAlbumsByTracks.js
@@ -1,5 +1,10 @@
 import {stitchArrays} from '../../util/sugar.js';
-import {filterByCount, sortByCount} from '../../util/wiki-data.js';
+
+import {
+  filterByCount,
+  sortAlphabetically,
+  sortByCount,
+} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: ['generateListingPage', 'linkAlbum'],
@@ -10,7 +15,7 @@ export default {
   },
 
   query({albumData}, spec) {
-    const albums = albumData.slice();
+    const albums = sortAlphabetically(albumData.slice());
     const counts = albums.map(album => album.tracks.length);
 
     filterByCount(albums, counts);
diff --git a/src/content/dependencies/listArtistsByCommentaryEntries.js b/src/content/dependencies/listArtistsByCommentaryEntries.js
index eae6dd6e..e3c70940 100644
--- a/src/content/dependencies/listArtistsByCommentaryEntries.js
+++ b/src/content/dependencies/listArtistsByCommentaryEntries.js
@@ -1,5 +1,9 @@
 import {stitchArrays} from '../../util/sugar.js';
-import {filterByCount, sortByCount} from '../../util/wiki-data.js';
+import {
+  filterByCount,
+  sortAlphabetically,
+  sortByCount,
+} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: ['generateListingPage', 'linkArtist'],
@@ -10,7 +14,7 @@ export default {
   },
 
   query({artistData}, spec) {
-    const artists = artistData.slice();
+    const artists = sortAlphabetically(artistData.slice());
     const counts =
       artists.map(artist =>
         artist.tracksAsCommentator.length +
diff --git a/src/content/dependencies/listArtistsByContributions.js b/src/content/dependencies/listArtistsByContributions.js
index 442b8329..63c8d4b8 100644
--- a/src/content/dependencies/listArtistsByContributions.js
+++ b/src/content/dependencies/listArtistsByContributions.js
@@ -1,5 +1,10 @@
 import {stitchArrays, unique} from '../../util/sugar.js';
-import {filterByCount, sortByCount} from '../../util/wiki-data.js';
+
+import {
+  filterByCount,
+  sortAlphabetically,
+  sortByCount,
+} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: ['generateListingPage', 'linkArtist'],
@@ -19,7 +24,7 @@ export default {
     };
 
     const queryContributionInfo = (artistsKey, countsKey, fn) => {
-      const artists = sprawl.artistData.slice();
+      const artists = sortAlphabetically(sprawl.artistData.slice());
       const counts = artists.map(artist => fn(artist));
 
       filterByCount(artists, counts);
diff --git a/src/content/dependencies/listArtistsByDuration.js b/src/content/dependencies/listArtistsByDuration.js
index 478e99bb..4c3bd81e 100644
--- a/src/content/dependencies/listArtistsByDuration.js
+++ b/src/content/dependencies/listArtistsByDuration.js
@@ -1,5 +1,11 @@
 import {stitchArrays} from '../../util/sugar.js';
-import {filterByCount, getTotalDuration, sortByCount} from '../../util/wiki-data.js';
+
+import {
+  filterByCount,
+  getTotalDuration,
+  sortAlphabetically,
+  sortByCount,
+} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: ['generateListingPage', 'linkArtist'],
@@ -10,7 +16,7 @@ export default {
   },
 
   query({artistData}, spec) {
-    const artists = artistData.slice();
+    const artists = sortAlphabetically(artistData.slice());
     const durations = artists.map(artist =>
       getTotalDuration([
         ...(artist.tracksAsArtist ?? []),
diff --git a/src/content/dependencies/listGroupsByAlbums.js b/src/content/dependencies/listGroupsByAlbums.js
index 2235c0dd..fac74d9f 100644
--- a/src/content/dependencies/listGroupsByAlbums.js
+++ b/src/content/dependencies/listGroupsByAlbums.js
@@ -1,5 +1,9 @@
 import {stitchArrays} from '../../util/sugar.js';
-import {filterByCount, sortByCount} from '../../util/wiki-data.js';
+import {
+  filterByCount,
+  sortAlphabetically,
+  sortByCount,
+} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: ['generateListingPage', 'linkGroup'],
@@ -10,7 +14,7 @@ export default {
   },
 
   query({groupData}, spec) {
-    const groups = groupData.slice();
+    const groups = sortAlphabetically(groupData.slice());
     const counts = groups.map(group => group.albums.length);
 
     filterByCount(groups, counts);
diff --git a/src/content/dependencies/listGroupsByDuration.js b/src/content/dependencies/listGroupsByDuration.js
index cf24a472..82ad5afc 100644
--- a/src/content/dependencies/listGroupsByDuration.js
+++ b/src/content/dependencies/listGroupsByDuration.js
@@ -1,5 +1,11 @@
 import {stitchArrays} from '../../util/sugar.js';
-import {filterByCount, getTotalDuration, sortByCount} from '../../util/wiki-data.js';
+
+import {
+  filterByCount,
+  getTotalDuration,
+  sortAlphabetically,
+  sortByCount,
+} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: ['generateListingPage', 'linkGroup'],
@@ -10,7 +16,7 @@ export default {
   },
 
   query({groupData}, spec) {
-    const groups = groupData.slice();
+    const groups = sortAlphabetically(groupData.slice());
     const durations =
       groups.map(group =>
         getTotalDuration(
diff --git a/src/content/dependencies/listGroupsByTracks.js b/src/content/dependencies/listGroupsByTracks.js
index 35ce153d..ab2d4598 100644
--- a/src/content/dependencies/listGroupsByTracks.js
+++ b/src/content/dependencies/listGroupsByTracks.js
@@ -1,5 +1,10 @@
 import {accumulateSum, stitchArrays} from '../../util/sugar.js';
-import {filterByCount, sortByCount} from '../../util/wiki-data.js';
+
+import {
+  filterByCount,
+  sortAlphabetically,
+  sortByCount,
+} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: ['generateListingPage', 'linkGroup'],
@@ -10,7 +15,7 @@ export default {
   },
 
   query({groupData}, spec) {
-    const groups = groupData.slice();
+    const groups = sortAlphabetically(groupData.slice());
     const counts =
       groups.map(group =>
         accumulateSum(
diff --git a/src/content/dependencies/listTagsByUses.js b/src/content/dependencies/listTagsByUses.js
index 81b66424..4bc963be 100644
--- a/src/content/dependencies/listTagsByUses.js
+++ b/src/content/dependencies/listTagsByUses.js
@@ -1,5 +1,10 @@
 import {stitchArrays} from '../../util/sugar.js';
-import {filterByCount, sortByCount} from '../../util/wiki-data.js';
+
+import {
+  filterByCount,
+  sortAlphabetically,
+  sortByCount,
+} from '../../util/wiki-data.js';
 
 export default {
   contentDependencies: ['generateListingPage', 'linkArtTag'],
@@ -10,8 +15,14 @@ export default {
   },
 
   query({artTagData}, spec) {
-    const artTags = artTagData.filter(tag => !tag.isContentWarning);
-    const counts = artTags.map(tag => tag.taggedInThings.length);
+    const artTags =
+      sortAlphabetically(
+        artTagData
+          .filter(tag => !tag.isContentWarning));
+
+    const counts =
+      artTags
+        .map(tag => tag.taggedInThings.length);
 
     filterByCount(artTags, counts);
     sortByCount(artTags, counts, {greatestFirst: true});