Browse Source

:bug: accounting for sortname

tags/0.9.0
J 4 years ago
parent
commit
87c2496bc1
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      vue-theme/src/store/modules/artist.js

+ 4
- 3
vue-theme/src/store/modules/artist.js View File

41
     artistsList.forEach((artist, i) => {
41
     artistsList.forEach((artist, i) => {
42
         const lastWord = artist.slug.split('-').filter(c => c).pop()
42
         const lastWord = artist.slug.split('-').filter(c => c).pop()
43
         const firstCharaOfLastWord = lastWord[0]
43
         const firstCharaOfLastWord = lastWord[0]
44
-        
44
+        const firstCharaOfSortWord = artist.sortname[0]
45
+        const charaIndex = alphabet.indexOf(firstCharaOfLastWord) < alphabet.indexOf(firstCharaOfSortWord) ? alphabet.indexOf(firstCharaOfLastWord) : alphabet.indexOf(firstCharaOfSortWord)
45
         // The first artist you've seen in this batch
46
         // The first artist you've seen in this batch
46
         if(i == 0) {
47
         if(i == 0) {
47
-            seen = alphabet.indexOf(firstCharaOfLastWord)
48
+            seen = charaIndex
48
             console.log(alphabet[seen], seen)
49
             console.log(alphabet[seen], seen)
49
             flatPacked.push({ slug: alphabet[seen], title: alphabet[seen], inbetween: true })
50
             flatPacked.push({ slug: alphabet[seen], title: alphabet[seen], inbetween: true })
50
         }
51
         }
51
 
52
 
52
-        if (alphabet.indexOf(firstCharaOfLastWord) == seen + 1) {
53
+        if (charaIndex == seen + 1) {
53
             seen++
54
             seen++
54
             flatPacked.push({ slug: alphabet[seen], title: alphabet[seen], inbetween: true })
55
             flatPacked.push({ slug: alphabet[seen], title: alphabet[seen], inbetween: true })
55
         }
56
         }

Loading…
Cancel
Save